mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-05-05 08:44:24 +00:00
Implement switches as automations
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
blueprint:
|
||||
name: Aqara single switch
|
||||
domain: automation
|
||||
input:
|
||||
z2m_topic:
|
||||
click:
|
||||
default: []
|
||||
double_click:
|
||||
default: []
|
||||
hold:
|
||||
default: []
|
||||
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: !input z2m_topic
|
||||
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload_json.click == 'single' }}"
|
||||
sequence: !input click
|
||||
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload_json.click == 'double' }}"
|
||||
sequence: !input double_click
|
||||
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload_json.action == 'hold' }}"
|
||||
sequence: !input hold
|
||||
@@ -0,0 +1,204 @@
|
||||
blueprint:
|
||||
name: Oppo 6 button switch controls
|
||||
domain: automation
|
||||
input:
|
||||
opple_z2m_name:
|
||||
action_sensor:
|
||||
button_1_single:
|
||||
default: []
|
||||
button_1_double:
|
||||
default: []
|
||||
button_1_triple:
|
||||
default: []
|
||||
button_1_release:
|
||||
default: []
|
||||
button_2_single:
|
||||
default: []
|
||||
button_2_double:
|
||||
default: []
|
||||
button_2_triple:
|
||||
default: []
|
||||
button_2_release:
|
||||
default: []
|
||||
button_3_single:
|
||||
default: []
|
||||
button_3_double:
|
||||
default: []
|
||||
button_3_triple:
|
||||
default: []
|
||||
button_3_release:
|
||||
default: []
|
||||
button_4_single:
|
||||
default: []
|
||||
button_4_double:
|
||||
default: []
|
||||
button_4_triple:
|
||||
default: []
|
||||
button_4_release:
|
||||
default: []
|
||||
button_5_single:
|
||||
default: []
|
||||
button_5_double:
|
||||
default: []
|
||||
button_5_triple:
|
||||
default: []
|
||||
button_5_release:
|
||||
default: []
|
||||
button_6_single:
|
||||
default: []
|
||||
button_6_double:
|
||||
default: []
|
||||
button_6_triple:
|
||||
default: []
|
||||
button_6_release:
|
||||
default: []
|
||||
|
||||
mode: queued
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: !input opple_z2m_name
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_1_single'
|
||||
sequence: !input button_1_single
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_1_double'
|
||||
sequence: !input button_1_double
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_1_triple'
|
||||
sequence: !input button_1_triple
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_1_release'
|
||||
sequence: !input button_1_release
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_2_single'
|
||||
sequence: !input button_2_single
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_2_double'
|
||||
sequence: !input button_2_double
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_2_triple'
|
||||
sequence: !input button_2_triple
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_2_release'
|
||||
sequence: !input button_2_release
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_3_single'
|
||||
sequence: !input button_3_single
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_3_double'
|
||||
sequence: !input button_3_double
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_3_triple'
|
||||
sequence: !input button_3_triple
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_3_release'
|
||||
sequence: !input button_3_release
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_4_single'
|
||||
sequence: !input button_4_single
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_4_double'
|
||||
sequence: !input button_4_double
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_4_triple'
|
||||
sequence: !input button_4_triple
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_4_release'
|
||||
sequence: !input button_4_release
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_5_single'
|
||||
sequence: !input button_5_single
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_5_double'
|
||||
sequence: !input button_5_double
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_5_triple'
|
||||
sequence: !input button_5_triple
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_5_release'
|
||||
sequence: !input button_5_release
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_6_single'
|
||||
sequence: !input button_6_single
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_6_double'
|
||||
sequence: !input button_6_double
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_6_triple'
|
||||
sequence: !input button_6_triple
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: !input action_sensor
|
||||
state: 'button_6_release'
|
||||
sequence: !input button_6_release
|
||||
@@ -32,8 +32,6 @@ cards:
|
||||
service: automation.reload
|
||||
- entity: sensor.automations_count
|
||||
icon: mdi:pound
|
||||
- automation.living_room_opple
|
||||
- automation.bedroom_opple
|
||||
- automation.titanium_turn_off_when_idle
|
||||
- automation.titanium_notify_on_vibration_sensor_move
|
||||
- automation.speech_enable_when_meeting_is_over
|
||||
@@ -51,6 +49,17 @@ cards:
|
||||
- automation.routine_coming_home_left_work
|
||||
- automation.presence_leaving_work
|
||||
|
||||
- type: entities
|
||||
title: Switches
|
||||
show_header_toggle: false
|
||||
icon: mdi:switch
|
||||
entities:
|
||||
- automation.living_room_opple
|
||||
- automation.living_room_desk_switch
|
||||
- automation.bedroom_opple
|
||||
- automation.bedroom_bedside_switch
|
||||
- automation.bathroom_switch
|
||||
|
||||
- type: entities
|
||||
title: Lighting
|
||||
show_header_toggle: false
|
||||
@@ -62,13 +71,8 @@ cards:
|
||||
- automation.lighting_temperature_adjust_on_start
|
||||
- automation.lighting_temperature_adjust_based_on_time
|
||||
- type: divider
|
||||
- automation.lighting_living_room_toggle_ceiling_lights_on_desk_switch_single_click
|
||||
- automation.lighting_living_room_toggle_ambient_lights_on_desk_switch_double_click
|
||||
- type: divider
|
||||
- automation.lighting_master_bedroom_toggle_lights_on_switch_single_click
|
||||
- automation.lighting_master_bedroom_toggle_ambient_lights_on_switch_double_click
|
||||
- automation.lighting_master_bedroom_toggle_lights_on_bedside_switch_single_click
|
||||
- automation.lighting_master_bedroom_toggle_ambient_lights_on_bedside_switch_double_click
|
||||
- type: divider
|
||||
- automation.lighting_kitchen_motion_on
|
||||
- automation.lighting_kitchen_motion_off
|
||||
@@ -97,12 +101,9 @@ cards:
|
||||
- automation.tv_plex_setup_house_for_plex
|
||||
- automation.tv_plex_restore_house_after_plex
|
||||
- automation.youtube_download_latest_pds
|
||||
- automation.youtube_play_latest_pds_on_bathroom_switch_dobule_click
|
||||
- automation.media_sonos_put_beam_in_night_mode
|
||||
- automation.media_sonos_put_beam_in_day_mode
|
||||
- automation.media_sonos_volume_up_on_bathroom_switch_click
|
||||
- type: divider
|
||||
- automation.music_living_room_play_pause_on_desk_switch_hold
|
||||
- automation.music_master_bedroom_play_pause_on_switch_hold
|
||||
|
||||
- type: entities
|
||||
@@ -120,7 +121,6 @@ cards:
|
||||
- automation.house_mode_set_to_day
|
||||
- automation.house_mode_set_to_bed
|
||||
- automation.house_mode_set_to_night
|
||||
- automation.house_mode_toggle_on_bedside_switch_hold
|
||||
- automation.house_mode_set_to_day_if_bedroom_door_was_opened
|
||||
|
||||
- type: entities
|
||||
|
||||
@@ -8,12 +8,6 @@ input_number:
|
||||
icon: mdi:speaker
|
||||
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "Bathroom switch click"
|
||||
state_topic: "z2m_deconz/bathroom_switch"
|
||||
availability_topic: "z2m_deconz/bridge/state"
|
||||
icon: "mdi:toggle-switch"
|
||||
value_template: "{{ value_json.click }}"
|
||||
- platform: mqtt
|
||||
name: "Bathroom switch battery"
|
||||
state_topic: "z2m_deconz/bathroom_switch"
|
||||
@@ -21,12 +15,6 @@ sensor:
|
||||
unit_of_measurement: "%"
|
||||
device_class: "battery"
|
||||
value_template: "{{ value_json.battery }}"
|
||||
- platform: mqtt
|
||||
name: "Bathroom switch action"
|
||||
state_topic: "z2m_deconz/bathroom_switch"
|
||||
availability_topic: "z2m_deconz/bridge/state"
|
||||
icon: "mdi:gesture-double-tap"
|
||||
value_template: "{{ value_json.action }}"
|
||||
- platform: mqtt
|
||||
name: "Bathroom switch LQI"
|
||||
state_topic: "z2m_deconz/bathroom_switch"
|
||||
@@ -36,37 +24,26 @@ sensor:
|
||||
value_template: "{{ value_json.linkquality }}"
|
||||
|
||||
automation:
|
||||
- alias: Media · Sonos · Volume up on bathroom switch click
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/bathroom_switch"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sensor.bathroom_switch_click
|
||||
state: 'single'
|
||||
action:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.bathroom
|
||||
data_template:
|
||||
volume_level: >-
|
||||
- alias: Bathroom · Switch
|
||||
use_blueprint:
|
||||
path: aqara_switch.yaml
|
||||
input:
|
||||
z2m_topic: "z2m_deconz/bathroom_switch"
|
||||
click:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.bathroom
|
||||
data_template:
|
||||
volume_level: >-
|
||||
|
||||
{% if state_attr('media_player.bathroom', 'volume_level')|float > (states('input_number.bathroom_high_volume')|float - 0.05) %}
|
||||
0.25
|
||||
{% else %}
|
||||
{{ states('input_number.bathroom_high_volume')|float }}
|
||||
{% endif %}
|
||||
{% if state_attr('media_player.bathroom', 'volume_level')|float > (states('input_number.bathroom_high_volume')|float - 0.05) %}
|
||||
0.25
|
||||
{% else %}
|
||||
{{ states('input_number.bathroom_high_volume')|float }}
|
||||
{% endif %}
|
||||
|
||||
- alias: Youtube · play latest pds on bathroom switch dobule click
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/bathroom_switch"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sensor.bathroom_switch_click
|
||||
state: 'double'
|
||||
action:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.bathroom
|
||||
data_template:
|
||||
volume_level: "{{ states('input_number.bathroom_high_volume')|float }}"
|
||||
- service: script.youtube_play_latest_pds
|
||||
double_click:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.bathroom
|
||||
data_template:
|
||||
volume_level: "{{ states('input_number.bathroom_high_volume')|float }}"
|
||||
- service: script.youtube_play_latest_pds
|
||||
|
||||
@@ -22,155 +22,95 @@ sensor:
|
||||
|
||||
automation:
|
||||
- alias: Bedroom · Opple
|
||||
mode: queued
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/opple_1"
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_1_single'
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
use_blueprint:
|
||||
path: oppo_6_btn_switch.yaml
|
||||
input:
|
||||
opple_z2m_name: "z2m_deconz/opple_1"
|
||||
action_sensor: sensor.bedroom_opple_action
|
||||
|
||||
button_1_single:
|
||||
- service: light.turn_off
|
||||
entity_id: light.master_bedroom
|
||||
|
||||
button_2_single:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id: light.master_bedroom
|
||||
brightness_pct: >-
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_2_single'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id: light.master_bedroom
|
||||
brightness_pct: >-
|
||||
{% if not is_state('input_select.house_mode', 'day') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
|
||||
{% if not is_state('input_select.house_mode', 'day') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
button_1_double:
|
||||
- service: light.turn_off
|
||||
entity_id: light.master_bedroom_main
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_1_double'
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
button_2_double:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id: light.master_bedroom_main
|
||||
brightness_pct: >-
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_2_double'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id: light.master_bedroom_main
|
||||
brightness_pct: >-
|
||||
{% if not is_state('input_select.house_mode', 'day') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
|
||||
{% if not is_state('input_select.house_mode', 'day') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
button_1_triple:
|
||||
- service: light.turn_off
|
||||
entity_id:
|
||||
- light.bedside
|
||||
- light.bed_led
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_1_triple'
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
button_2_triple:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id:
|
||||
- light.bedside
|
||||
- light.bed_led
|
||||
brightness_pct: >-
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_2_triple'
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
entity_id:
|
||||
- light.bedside
|
||||
- light.bed_led
|
||||
brightness_pct: >-
|
||||
{% if not is_state('input_select.house_mode', 'day') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
|
||||
{% if not is_state('input_select.house_mode', 'day') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
button_3_single:
|
||||
- service: media_player.media_play_pause
|
||||
entity_id: media_player.master_bedroom
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_3_single'
|
||||
sequence:
|
||||
- service: media_player.media_play_pause
|
||||
entity_id: media_player.master_bedroom
|
||||
button_3_double:
|
||||
- service: script.sonos_join_tv
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_3_double'
|
||||
sequence:
|
||||
- service: script.sonos_join_tv
|
||||
button_3_triple:
|
||||
- service: script.sonos_join_bedroom
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_3_triple'
|
||||
sequence:
|
||||
- service: script.sonos_join_bedroom
|
||||
button_3_release:
|
||||
- service: media_player.play_next
|
||||
entity_id: media_player.master_bedroom
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_3_release'
|
||||
sequence:
|
||||
- service: media_player.play_next
|
||||
entity_id: media_player.master_bedroom
|
||||
button_4_single:
|
||||
- service: script.music_play
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_4_single'
|
||||
sequence:
|
||||
- service: script.music_play
|
||||
button_4_double:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Starred'
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_4_double'
|
||||
sequence:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Starred'
|
||||
button_4_triple:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Retro'
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_4_triple'
|
||||
sequence:
|
||||
- service: script.music_play
|
||||
data:
|
||||
playlist: 'Retro'
|
||||
button_5_single:
|
||||
- service: fan.turn_off
|
||||
entity_id: fan.philips_airpurifier
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_5_single'
|
||||
sequence:
|
||||
- service: fan.turn_off
|
||||
entity_id: fan.philips_airpurifier
|
||||
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: sensor.bedroom_opple_action
|
||||
state: 'button_6_single'
|
||||
sequence:
|
||||
- service: fan.turn_on
|
||||
entity_id: fan.philips_airpurifier
|
||||
button_6_single:
|
||||
- service: fan.turn_on
|
||||
entity_id: fan.philips_airpurifier
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "Bedside switch click"
|
||||
state_topic: "z2m_deconz/bedside_switch"
|
||||
availability_topic: "z2m_deconz/bridge/state"
|
||||
icon: "mdi:toggle-switch"
|
||||
value_template: "{{ value_json.click }}"
|
||||
- platform: mqtt
|
||||
name: "Bedside switch battery"
|
||||
state_topic: "z2m_deconz/bedside_switch"
|
||||
@@ -12,12 +6,6 @@ sensor:
|
||||
unit_of_measurement: "%"
|
||||
device_class: "battery"
|
||||
value_template: "{{ value_json.battery }}"
|
||||
- platform: mqtt
|
||||
name: "Bedside switch action"
|
||||
state_topic: "z2m_deconz/bedside_switch"
|
||||
availability_topic: "z2m_deconz/bridge/state"
|
||||
icon: "mdi:gesture-double-tap"
|
||||
value_template: "{{ value_json.action }}"
|
||||
- platform: mqtt
|
||||
name: "Bedside switch LQI"
|
||||
state_topic: "z2m_deconz/bedside_switch"
|
||||
@@ -27,55 +15,39 @@ sensor:
|
||||
value_template: "{{ value_json.linkquality }}"
|
||||
|
||||
automation:
|
||||
- alias: Lighting · Master bedroom · Toggle lights on bedside switch single click
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/bedside_switch"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sensor.bedside_switch_click
|
||||
state: 'single'
|
||||
action:
|
||||
- service: light.toggle
|
||||
data_template:
|
||||
entity_id: >-
|
||||
- alias: Bedroom · Bedside Switch
|
||||
use_blueprint:
|
||||
path: aqara_switch.yaml
|
||||
input:
|
||||
z2m_topic: "z2m_deconz/bedside_switch"
|
||||
click:
|
||||
- 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', '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 %}
|
||||
{% if is_state('input_select.house_mode', 'night') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
|
||||
- alias: Lighting · Master bedroom · Toggle ambient lights on bedside switch double click
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/bedside_switch"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sensor.bedside_switch_click
|
||||
state: 'double'
|
||||
action:
|
||||
- service: light.toggle
|
||||
data_template:
|
||||
entity_id:
|
||||
- light.bedside
|
||||
- light.bed_led
|
||||
brightness_pct: 100
|
||||
double_click:
|
||||
- service: light.toggle
|
||||
data_template:
|
||||
entity_id:
|
||||
- light.bedside
|
||||
- light.bed_led
|
||||
brightness_pct: 100
|
||||
|
||||
- alias: House mode · Toggle on bedside switch hold
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.bedside_switch_action
|
||||
to: 'hold'
|
||||
action:
|
||||
- service: input_select.select_next
|
||||
entity_id: input_select.house_mode
|
||||
hold:
|
||||
- service: input_select.select_next
|
||||
entity_id: input_select.house_mode
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "Desk switch click"
|
||||
state_topic: "z2m_deconz/desk_switch"
|
||||
availability_topic: "z2m_deconz/bridge/state"
|
||||
icon: "mdi:toggle-switch"
|
||||
value_template: "{{ value_json.click }}"
|
||||
- platform: mqtt
|
||||
name: "Desk switch battery"
|
||||
state_topic: "z2m_deconz/desk_switch"
|
||||
@@ -12,12 +6,6 @@ sensor:
|
||||
unit_of_measurement: "%"
|
||||
device_class: "battery"
|
||||
value_template: "{{ value_json.battery }}"
|
||||
- platform: mqtt
|
||||
name: "Desk switch action"
|
||||
state_topic: "z2m_deconz/desk_switch"
|
||||
availability_topic: "z2m_deconz/bridge/state"
|
||||
icon: "mdi:gesture-double-tap"
|
||||
value_template: "{{ value_json.action }}"
|
||||
- platform: mqtt
|
||||
name: "Desk switch LQI"
|
||||
state_topic: "z2m_deconz/desk_switch"
|
||||
@@ -28,51 +16,35 @@ sensor:
|
||||
|
||||
|
||||
automation:
|
||||
- alias: Lighting · Living Room · Toggle ceiling lights on desk switch single click
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/desk_switch"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sensor.desk_switch_click
|
||||
state: 'single'
|
||||
action:
|
||||
- service: light.toggle
|
||||
data_template:
|
||||
entity_id: light.living_room_main
|
||||
brightness_pct: >-
|
||||
- alias: Living room · Desk switch
|
||||
use_blueprint:
|
||||
path: aqara_switch.yaml
|
||||
input:
|
||||
z2m_topic: "z2m_deconz/desk_switch"
|
||||
click:
|
||||
- service: light.toggle
|
||||
data_template:
|
||||
entity_id: light.living_room_main
|
||||
brightness_pct: >-
|
||||
|
||||
{% if is_state('input_select.house_mode', 'night') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
{% if is_state('input_select.house_mode', 'night') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
|
||||
- alias: Lighting · Living Room · Toggle ambient lights on desk switch double click
|
||||
trigger:
|
||||
platform: mqtt
|
||||
topic: "z2m_deconz/desk_switch"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: sensor.desk_switch_click
|
||||
state: 'double'
|
||||
action:
|
||||
- service: light.toggle
|
||||
data_template:
|
||||
entity_id: light.living_room_ambient
|
||||
brightness_pct: >-
|
||||
double_click:
|
||||
- service: light.toggle
|
||||
data_template:
|
||||
entity_id: light.living_room_ambient
|
||||
brightness_pct: >-
|
||||
|
||||
{% if is_state('input_select.house_mode', 'night') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
{% if is_state('input_select.house_mode', 'night') %}
|
||||
40
|
||||
{% else %}
|
||||
100
|
||||
{% endif %}
|
||||
|
||||
- alias: Music · Living Room · Play pause on desk switch hold
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.desk_switch_action
|
||||
to: 'hold'
|
||||
action:
|
||||
- service: media_player.media_play_pause
|
||||
entity_id: media_player.living_room
|
||||
hold:
|
||||
- service: media_player.media_play_pause
|
||||
entity_id: media_player.living_room
|
||||
|
||||
@@ -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