@sernafa wrote:
Hi, I need some help with configuring this senson with rest and value_template. In my configuration.yml file:
- platform: rest resource: http://localhost:3000/api/v1/hvac json_attributes: - data name: airzone method: POST payload: '{"systemID":1,"zoneID":0}' scan_interval: 60 value_template: 'OK' - platform: template sensors: blueface_status: friendly_name: Status value_template: {{ states.sensor.airzone.attributes.data.0.on }}
{{ states.sensor.airzone.attributes.data.0.on }} show values 0 or 1, depending on the operating status. It’s ok.
Is it possible to use an ‘if’, as an example although it is incorrect, to be able to show “running -> 1” and “stopped -> 0”?
Ex:
value_template: >- --> {% if {{ states.sensor.airzone.attributes.data.0.on }} == '1' %} <-- Running {% else %} Stopped {% endif %}
Thks in advance.
Posts: 5
Participants: 3