Skip to content

Commit

Permalink
feat: close covers only if tv is used and not if only playbar is used
Browse files Browse the repository at this point in the history
  • Loading branch information
TribuneX committed Jan 21, 2024
1 parent 6701d1a commit 0717eae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion automation/media/tv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
- service: script.close_covers_for_tv
- wait_for_trigger:
platform: state
entity_id: switch.sonos_playbar
entity_id: switch.tv_media
from: "on"
to: "off"
- service: script.open_covers_for_tv
18 changes: 13 additions & 5 deletions includes/scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,24 @@ apple_tv_sleep:
target:
entity_id: media_player.wohnzimmer

turn_on_tv:
turn_tv_and_playbar:
sequence:
- service: switch.turn_on
data:
entity_id:
- switch.sonos_playbar
- service: script.turn_on_tv

turn_off_tv_and_playbar:
sequence:
- service: switch.turn_off
data:
entity_id:
- switch.sonos_playbar
- service: script.turn_off_tv

turn_on_tv:
sequence:
- service: remote.send_command
data:
entity_id: remote.wohnzimmer
Expand All @@ -359,10 +371,6 @@ turn_on_tv:

turn_off_tv:
sequence:
- service: switch.turn_off
data:
entity_id:
- switch.sonos_playbar
- service: script.apple_tv_sleep

toggle_speaker_and_light_childroom:
Expand Down
7 changes: 6 additions & 1 deletion includes/switch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
service: vacuum.return_to_base
entity_id: vacuum.vacuum_cleaner
tv_media:
value_template: "{{ is_state('switch.sonos_playbar', 'on')}}"
value_template: "{{ is_state('switch.tv', 'on')}}"
turn_on:
service: script.turn_on_tv_and_playbar
turn_off:
service: script.turn_off_tv_and_playbar
tv:
turn_on:
service: script.turn_on_tv
turn_off:
Expand Down

0 comments on commit 0717eae

Please sign in to comment.