mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-05-13 19:54:42 +00:00
Implement switches as automations
This commit is contained in:
@@ -22,188 +22,112 @@ sensor:
|
||||
|
||||
automation:
|
||||
- alias: Living room · Opple
|
||||
mode: queued
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/opple_2"
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_1_single'
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
entity_id: light.living_room
|
||||
use_blueprint:
|
||||
path: oppo_6_btn_switch.yaml
|
||||
input:
|
||||
opple_z2m_name: "z2m_deconz/opple_2"
|
||||
action_sensor: sensor.living_room_opple_action
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_2_single'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room
|
||||
button_1_single:
|
||||
- service: light.turn_off
|
||||
entity_id: light.living_room
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_1_double'
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
entity_id: light.living_room_main
|
||||
button_2_single:
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_2_double'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room_main
|
||||
button_1_double:
|
||||
- service: light.turn_off
|
||||
entity_id: light.living_room_main
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_1_triple'
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
entity_id: light.living_room_ambient
|
||||
button_2_double:
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room_main
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_2_triple'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room_ambient
|
||||
button_1_triple:
|
||||
- service: light.turn_off
|
||||
entity_id: light.living_room_ambient
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_2_release'
|
||||
sequence:
|
||||
- service: script.scene_living_room_ambient_neon
|
||||
button_2_triple:
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room_ambient
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_3_single'
|
||||
sequence:
|
||||
- service: media_player.media_play_pause
|
||||
entity_id: media_player.living_room
|
||||
button_2_release:
|
||||
- service: script.scene_living_room_ambient_neon
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_3_double'
|
||||
sequence:
|
||||
- service: script.sonos_join_tv
|
||||
button_3_single:
|
||||
- service: media_player.media_play_pause
|
||||
entity_id: media_player.living_room
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_3_triple'
|
||||
sequence:
|
||||
- service: script.sonos_join_bedroom
|
||||
button_3_double:
|
||||
- service: script.sonos_join_tv
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_3_release'
|
||||
sequence:
|
||||
- service: media_player.play_next
|
||||
entity_id: media_player.living_room
|
||||
button_3_triple:
|
||||
- service: script.sonos_join_bedroom
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_4_single'
|
||||
sequence:
|
||||
- service: script.music_play
|
||||
button_3_release:
|
||||
- service: media_player.play_next
|
||||
entity_id: media_player.living_room
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_4_double'
|
||||
sequence:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Starred'
|
||||
button_4_single:
|
||||
- service: script.music_play
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_4_triple'
|
||||
sequence:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Retro'
|
||||
button_4_double:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Starred'
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_5_single'
|
||||
sequence:
|
||||
- service: climate.turn_off
|
||||
entity_id: climate.toshiba_ac
|
||||
button_4_triple:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Retro'
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_5_double'
|
||||
sequence:
|
||||
- service: climate.set_temperature
|
||||
entity_id: climate.toshiba_ac
|
||||
data_template:
|
||||
temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int -1}}"
|
||||
button_5_single:
|
||||
- service: climate.turn_off
|
||||
entity_id: climate.toshiba_ac
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_6_single'
|
||||
sequence:
|
||||
- service: script.toshiba_ac_on_cool
|
||||
button_5_double:
|
||||
- service: climate.set_temperature
|
||||
entity_id: climate.toshiba_ac
|
||||
data_template:
|
||||
temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int -1}}"
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_6_double'
|
||||
sequence:
|
||||
- service: climate.set_temperature
|
||||
entity_id: climate.toshiba_ac
|
||||
data_template:
|
||||
temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int +1}}"
|
||||
button_6_single:
|
||||
- service: script.toshiba_ac_on_cool
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.living_room_opple_action
|
||||
state: 'button_6_triple'
|
||||
sequence:
|
||||
- service: automation.turn_off
|
||||
entity_id: automation.tv_sonos_join_tv_on_google_cast
|
||||
button_6_double:
|
||||
- service: climate.set_temperature
|
||||
entity_id: climate.toshiba_ac
|
||||
data_template:
|
||||
temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int +1}}"
|
||||
|
||||
- service: script.tv_fireplace
|
||||
button_6_triple:
|
||||
- service: automation.turn_off
|
||||
entity_id: automation.tv_sonos_join_tv_on_google_cast
|
||||
|
||||
- service: sonos.join
|
||||
entity_id:
|
||||
- media_player.kitchen
|
||||
- media_player.bathroom
|
||||
data:
|
||||
master: media_player.master_bedroom
|
||||
- service: script.tv_fireplace
|
||||
|
||||
# Music play, without the join
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
volume_level: 0.2
|
||||
- service: media_player.shuffle_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
shuffle: true
|
||||
- service: media_player.select_source
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
source: "Evening Chill"
|
||||
- service: sonos.join
|
||||
entity_id:
|
||||
- media_player.kitchen
|
||||
- media_player.bathroom
|
||||
data:
|
||||
master: media_player.master_bedroom
|
||||
|
||||
- delay: 00:01:00
|
||||
- service: automation.turn_on
|
||||
entity_id: automation.tv_sonos_join_tv_on_google_cast
|
||||
# Music play, without the join
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
volume_level: 0.2
|
||||
- service: media_player.shuffle_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
shuffle: true
|
||||
- service: media_player.select_source
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
source: "Evening Chill"
|
||||
|
||||
- delay: 00:01:00
|
||||
- service: automation.turn_on
|
||||
entity_id: automation.tv_sonos_join_tv_on_google_cast
|
||||
|
||||
Reference in New Issue
Block a user