Witam, mam problem jak odczytać dane z zewnętrznego API. Chce je wykorzystać do stworzenia sensora w home assistant, przesłać przez mqtt out w node-red, interesują mnie informacje z measurement.
w configuration.yaml dodałem
sensor:
- platform: mqtt
state_topic: '/homeassistant/septic_tank'
name: septic_tank
w Node-RED API w debug daje takie info.
{
"id":"xxxxxx",
"login":"xxxxxx",
"firstname":"xxxx",
"lastname":"xxxxx",
"email":"xxxxxxx",
"active":true,
"created":"2019-12-29 11:36:17",
"address":{
"address":"xxxxx",
"town":"xxxxx",
"postalcode":"xxxx",
"country":"Polska"
},
"locations":[
{
"id":"xxxxxx",
"name":"xxxxxx",
"created":"2019-12-29 11:36:17",
"max":130,
"alarm":125,
"adc1":5618,
"adc2":21412,
"cm1":1,
"cm2":102,
"active":false,
"tanktype":1,
"mainboard":"SZ0204",
"software":"9.0",
"direction":"growth",
"address":{
"address":"xxxxx",
"town":"xxxxx",
"postalcode":"xxxxx",
"country":"Polska"
},
"measurement":{
"percent":78,
"cm":97,
"temperature":10.6,
"volts":5.3,
"rssi":73,
"nextfull":"2020-11-28 08:40:22",
"lastempty":"2020-10-12 09:02:34",
"datatime":"2020-11-18 12:42:39"
}
}
]
}