RESTful Binary Sensor: value_template

Hi,

I am struggling to implement a RESTful Binary Sensor.

Here is what I’ve got in my configuration.yml:

binary_sensor:  
  - platform: rest
    resource: "https://www.hamburg.ccc.de/dooris/status.json"
    method: GET
    name: "z9"
    sensor_class: opening
    value_template: "{{ value_json.state.open }}"

state.open is either true or false.

Unfortunately I get the following ValueError:

return bool(int(self.rest.data))
ValueError: invalid literal for int() with base 10: 'False'

Could someone guide me here?

Thanks,
Jan

As far as I remember are binary sensors limited to 0 and 1 as values. Let me have a look for a little enhancement for other useful values.

1 Like

Thank you very much fabaff! This fix works for me.