I’m trying to generate some sensors from a JSON I receive via REST but it does not really work
this is my sensor config:
- platform: rest
name: bsb-lan
resource: http://192.168.1.6/JQ=8700,8830
json_attributes:
- 8700
- 8510
value_template: "OK"
- platform: template
sensors:
outside_temperature:
value_template: "{{ state_attr('sensor.bsb-lan', '8700')['value'] }}"
device_class: temperature
unit_of_measurement: "°C"
collector_temperature:
value_template: "{{ state_attr('sensor.bsb-lan', '8510')['value'] }}"
device_class: temperature
unit_of_measurement: "°C"
my json looks like this:
{
"8510": {
"name": "Kollektortemperatur 1",
"dataType_name": "TEMP",
"dataType_family": "VALS",
"error": 0,
"value": "26.8",
"desc": "",
"precision": 0.1,
"dataType": 0,
"readonly": 1,
"readwrite": 1,
"unit": "°C"
},
"8700": {
"name": "Außentemperatur",
"dataType_name": "TEMP",
"dataType_family": "VALS",
"error": 0,
"value": "23.5",
"desc": "",
"precision": 0.1,
"dataType": 0,
"readonly": 0,
"readwrite": 0,
"unit": "°C"
}
}
I’ve got the code from RESTful Sensor - Home Assistant but the sensors are still empty and in the logs is written:
[homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'value' when rendering '{{ state_attr('sensor.room_sensors', '8700')['value'] }}
Does anyone have any idea whats wrong here? Help much appreciated!