Hi,
Im trying to extract temperature value from a JSON generated on my Fibaro Home Center 2. The temperature is shown as “value” under “properties” (20.70) when calling my Fibaro motion sensor with;
http://192.168.x.xxx/api/devices?id=xxx
JSON;
{
"id":361,
"name":"Temperatur",
"roomID":416,
"type":"com.fibaro.temperatureSensor",
"baseType":"com.fibaro.multilevelSensor",
"enabled":true,
"visible":true,
"isPlugin":false,
"parentId":359,
"remoteGatewayId":0,
"interfaces":[ ],
"properties":{
"parameters":[ ],
"pollingTimeSec":0,
"wakeUpTime":18000,
"zwaveCompany":"Fibargroup",
"zwaveInfo":"3,3,67",
"zwaveVersion":"2.8",
"batteryLevel":"100",
"batteryLowNotification":"true",
"configured":true,
"dead":"false",
"defInterval":"0",
"deviceControlType":"0",
"deviceIcon":"30",
"emailNotificationID":"0",
"emailNotificationType":"0",
"endPointId":"0",
"liliOffCommand":"",
"liliOnCommand":"",
"log":"",
"logTemp":"",
"manufacturer":"",
"markAsDead":"true",
"maxInterval":"0",
"minInterval":"0",
"model":"",
"nodeId":"65",
"offset":"0.00",
"parametersTemplate":"270",
"productInfo":"1,15,8,0,16,1,2,8",
"pushNotificationID":"0",
"pushNotificationType":"0",
"remoteGatewayId":"0",
"saveLogs":"true",
"serialNumber":"",
"showFireAlarm":"true",
"showFreezeAlarm":"false",
"smsNotificationID":"0",
"smsNotificationType":"0",
"stepInterval":"0",
"unit":"C",
"useTemplate":"true",
"userDescription":"",
"value":"20.70"
},
"actions":{
"reconfigure":0,
"setInterval":1
},
"created":1516638096,
"modified":1516638096,
"sortOrder":99
}
configuration.yaml;
sensor:
- platform: rest
resource: http://192.168.0.150/api/devices?id=361
name: Arbetsrum
value_template: '{{ value_json.properties.value }}'
unit_of_measurement: "°C"
Im getting a parser error in the log. I have looked at similar posts but I cant figure this out, I guess I need to set the value_json correctly but the above principle works with other JSONs.
LOG:
Error parsing value: ‘value_json’ is undefined (value: , template: {{ value_json.properties.value }})
Can someone help me out? This could be useful for others moving or using Home Center 2 with HA.
Thanks!