diff --git a/config/packages/media_centre.yaml b/config/packages/media_centre.yaml index 53a1764..52b74bd 100644 --- a/config/packages/media_centre.yaml +++ b/config/packages/media_centre.yaml @@ -260,6 +260,9 @@ automation: # rule out error states (HA bootup, reloading, etc) - "{{ trigger.to_state.state not in ['unavailable', 'unknown'] }}" + # Without a `from`/`to` in trigger, it fires on any _update_ not necessarily a _change_ + - "{{ trigger.from_state.state != trigger.to_state.state }}" + # has to have been off or describing what is already playing - "{{ trigger.from_state.state in ['off', states('sensor.current_living_room_media_player_source')] }}" diff --git a/config/packages/offices.yaml b/config/packages/offices.yaml index b447480..2faf30d 100644 --- a/config/packages/offices.yaml +++ b/config/packages/offices.yaml @@ -39,6 +39,7 @@ automation: to: "off" for: minutes: 15 + condition: "{{ is_state('binary_sensor.bo_s_office_is_occupied', 'off') }}" action: - service: light.turn_off target: @@ -46,12 +47,18 @@ automation: - bo_s_office - if: - "{{ is_state('binary_sensor.bo_s_office_door_contact', 'off') }}" # closed - - "{{ is_state('binary_sensor.bo_s_office_is_occupied', 'off') }}" then: + - if: + - or: + - "{{ is_state('sensor.bandersnatch_displays', '1') }}" + - not: "{{ is_state('device_tracker.bandersnatch_hass', 'home') }}" + then: + - service: switch.turn_off + target: + entity_id: switch.bo_s_desk_plug - service: switch.turn_off target: - area_id: - - bo_s_office + entity_id: switch.bo_s_office_plug - id: 2d1034acdee3afde7b67224b4898bd87b5cd356c alias: Turn on Ri's office when door opened