I’m struggling to get a persistent state for a region. The state changes often between regions and empty (?) states.
Region 1 is my kitchen and I want to know when it is currently occupied. With the following binary sensor, it sets the occupation correctly, then immediately goes unoccupied.
- name: kitchen_occupied
device_class: presence
state: >-
{% if is_state('sensor.living_room_radar_action', 'region_1_occupied') %} on
{% elif is_state('sensor.living_room_radar_action', 'region_1_unoccupied') %} off
{% else %} {{ this.state.state }}
{% endif %}
Any ideas?