Template binary sensors never updating

I’ve been trying to get template binary sensors for my door and motion sensors to work and…they aren’t. If I set them up as regular template sensors they work fine, of course minus the pretty yellow door icon etc., but this just irks me. It should Just Work, darnit. Can anyone tell me why these buggers never update?

- platform: template
  sensors:
    hallbath_motion:
      friendly_name: "Hall Bathroom Motion"
      device_class: motion
      entity_id: sensor.vision_zp3111_multisensor_4in1_burglar
      value_template: '{% if is_state("sensor.vision_zp3111_multisensor_4in1_burglar", "8") %}On{% else %}Off{% endif %}'

Because the value_template needs to result in true or false, not “On” or “Off”. Try:

      value_template: '{{ is_state("sensor.vision_zp3111_multisensor_4in1_burglar", "8") }}'

Well that was just too easy…thank you!

1 Like