Hi,
I have trouble with the configuration of a restful binary sensor.
I have created this restful sensor that work fine:
sensor:
- platform: rest
name: luce_studio_stato
resource: "http://<valid address that returns an xml>"
value_template: "{{ value_json['root']['parametri']['parametro1'] }}"
the sensor above yields either 0 or 1, so I would like to use a binary sensor instead. I tried the following:
binary_sensor:
- platform: rest
name: luce_studio_stato
resource: "http://<valid address that returns an xml>"
value_template: "{{ value_json['root']['parametri']['parametro1'] }}"
but this does not work, the binary sensor is always OFF
and never changing.
According to the documentation it should not matter where the value is either 1
or "1"
, but nonethelesse I tried to evaluate "{{ value_json['root']['parametri']['parametro1'] == 1}}"
and "{{ value_json['root']['parametri']['parametro1'] == '1'}}"
do you have any idea what is not working, or how to understand what value_template
is evaluating?