I have a binary sensor that combines a few entities to determine if the house is occupied. This binary_sensor is on my main home assistant installation. One of the entities is a zwave motion sensor that is associated to an rpi instance running hassio which uses eventstream to send events to the main home assistant. My original plan of using the off/away state as true for all entities did not work correctly because the remote entity disapears from the main home assistant after a period of no activity. This is a known behavior and I’m not aware of a fix that still uses eventstream.
To get around this I reversed my logic for the zwave entity to be not is_state on, assuming even if the entity was not available it would pass as true. Despite this working in dev-template the binary sensor does not correctly show the house as empty presumably because the zwave motion sensor is not a listed entity.
I’m not completely surprised by this, this post is more to see see if others have seen the same behavior between config and dev-template.
binary_sensor:
- platform: template
sensors:
everyone_gone:
device_class: presence
value_template: >-
{{ is_state('cover.garage_door_opener', 'closed')
and is_state('device_tracker.person1', 'not_home')
and is_state('device_tracker.person2', 'not_home')
and not is_state('binary_sensor.dome_motion_detector_sensor', 'on') }}
I can also completely flip the logic and use OR’s and if any are true to get around this - I just wanted to scratch the itch of why the above logic doesn’t work despite the logic testing ok in dev.