Refactor packages - define automations per device where possible

This commit is contained in:
2020-05-16 13:51:01 +03:00
parent 279689c681
commit ccee1593bd
13 changed files with 84 additions and 85 deletions
@@ -0,0 +1,27 @@
automation:
- alias: Lighting · Master bedroom · Toggle lights on bedside switch single click
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_bedside_switch_ieee
command: single
action:
- service: light.toggle
data_template:
entity_id: >-
{% if is_state('input_select.house_mode', 'day') %}
light.master_bedroom_main
{% elif is_state('input_select.house_mode', 'bed') %}
light.bedside, light.bed_led
{% elif is_state('input_select.house_mode', 'night') %}
light.bed_led
{% endif %}
brightness_pct: >-
{% if is_state('input_select.house_mode', 'night') %}
40
{% else %}
100
{% endif %}
@@ -0,0 +1,45 @@
automation:
- alias: Lighting · Master bedroom · Toggle lights on switch single click
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_switch_ieee
command: single
action:
- service: light.toggle
data_template:
entity_id: light.master_bedroom_main
brightness_pct: >-
{% if is_state('input_select.house_mode', 'night') %}
40
{% else %}
100
{% endif %}
- alias: Lighting · Master bedroom · Toggle ambient lights on switch double click
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_switch_ieee
command: double
action:
- service: light.toggle
data_template:
entity_id:
- light.bedside
- light.bed_led
brightness_pct: 100
- alias: Music · Master bedroom · Play pause on switch hold
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_switch_ieee
command: hold
action:
- service: media_player.media_play_pause
entity_id: media_player.master_bedroom
@@ -36,3 +36,15 @@ automation:
{% else %} {% else %}
100 100
{% endif %} {% endif %}
- alias: Music · Living Room · Play pause on desk switch hold
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret desk_switch_ieee
command: hold
action:
- service: media_player.media_play_pause
entity_id: media_player.living_room
@@ -41,65 +41,3 @@ script:
data: data:
color_temp: 500 color_temp: 500
brightness_pct: 20 brightness_pct: 20
automation:
- alias: Lighting · Master bedroom · Toggle lights on bedside switch single click
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_bedside_switch_ieee
command: single
action:
- service: light.toggle
data_template:
entity_id: >-
{% if is_state('input_select.house_mode', 'day') %}
light.master_bedroom_main
{% elif is_state('input_select.house_mode', 'bed') %}
light.bedside, light.bed_led
{% elif is_state('input_select.house_mode', 'night') %}
light.bed_led
{% endif %}
brightness_pct: >-
{% if is_state('input_select.house_mode', 'night') %}
40
{% else %}
100
{% endif %}
- alias: Lighting · Master bedroom · Toggle lights on switch single click
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_switch_ieee
command: single
action:
- service: light.toggle
data_template:
entity_id: light.master_bedroom_main
brightness_pct: >-
{% if is_state('input_select.house_mode', 'night') %}
40
{% else %}
100
{% endif %}
- alias: Lighting · Master bedroom · Toggle ambient lights on switch double click
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_switch_ieee
command: double
action:
- service: light.toggle
data_template:
entity_id:
- light.bedside
- light.bed_led
brightness_pct: 100
-23
View File
@@ -20,26 +20,3 @@ script:
entity_id: media_player.master_bedroom entity_id: media_player.master_bedroom
data_template: data_template:
source: "{{ playlist | default('Evening Chill') }}" source: "{{ playlist | default('Evening Chill') }}"
automation:
- alias: Music · Living Room · Play pause on desk switch hold
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret desk_switch_ieee
command: hold
action:
- service: media_player.media_play_pause
entity_id: media_player.living_room
- alias: Music · Master bedroom · Play pause on switch hold
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: !secret master_bedroom_switch_ieee
command: hold
action:
- service: media_player.media_play_pause
entity_id: media_player.master_bedroom