@RalfP wrote:
Hi all,
I have the following working sensor (value_template), but I learned that it should be something with is_state_attr instead of states.sensor.
I just did not figure out the correct syntax for doing so.
- platform: rest resource: http://some.resource.ip.xy scan_interval: 10 name: "sensor_name" value_template: "{{ value_json['system.system_info'] }}" json_attributes: - system - platform: template sensors: oekofen_aussentemp: friendly_name: 'some_friendly_name' value_template: '{{ (((states.sensor.sensor_name.attributes["system"]["L_ambient"]|int) *0.1) | round(1) )}}' unit_of_measurement: "°C"
During startup I get this error message in the log but after some seconds the value is showing up.
Could not render template some_friendly_name: UndefinedError: 'mappingproxy object' has no attribute 'system'
I’ve read https://www.home-assistant.io/docs/configuration/templating/ up and down and other entries in the forum but this is the only working format I can craft.
Help highly appreciated
Ralf
Posts: 27
Participants: 5