mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-09-06 01:48:44 +00:00
Implement switches as automations
This commit is contained in:
+2
-2
@@ -6,14 +6,14 @@ source "$(dirname $0)/utils.sh"
|
|||||||
log "[upload] deleting old folders..."
|
log "[upload] deleting old folders..."
|
||||||
|
|
||||||
ssh $REMOTE_HOST -p $REMOTE_PORT \
|
ssh $REMOTE_HOST -p $REMOTE_PORT \
|
||||||
"rm -rf $REMOTE_REPO_PATH/config/{custom_scripts,lovelace,packages,templates}"
|
"rm -rf $REMOTE_REPO_PATH/config/{blueprints,custom_scripts,lovelace,packages,templates}"
|
||||||
|
|
||||||
log "[upload] ${LIGHT_GREEN}delete done${NO_FORMAT}"
|
log "[upload] ${LIGHT_GREEN}delete done${NO_FORMAT}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
log "[upload] reuploading..."
|
log "[upload] reuploading..."
|
||||||
scp -P $REMOTE_PORT \
|
scp -P $REMOTE_PORT \
|
||||||
-r config/{custom_scripts,lovelace,packages,templates,themes,*.yaml} \
|
-r config/{blueprints,custom_scripts,lovelace,packages,templates,themes,*.yaml} \
|
||||||
"${REMOTE_HOST}:${REMOTE_REPO_PATH}/config" > /dev/null
|
"${REMOTE_HOST}:${REMOTE_REPO_PATH}/config" > /dev/null
|
||||||
|
|
||||||
log "[upload] ${LIGHT_GREEN}reupload done${NO_FORMAT}"
|
log "[upload] ${LIGHT_GREEN}reupload done${NO_FORMAT}"
|
||||||
|
|||||||
@@ -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
|
service: automation.reload
|
||||||
- entity: sensor.automations_count
|
- entity: sensor.automations_count
|
||||||
icon: mdi:pound
|
icon: mdi:pound
|
||||||
- automation.living_room_opple
|
|
||||||
- automation.bedroom_opple
|
|
||||||
- automation.titanium_turn_off_when_idle
|
- automation.titanium_turn_off_when_idle
|
||||||
- automation.titanium_notify_on_vibration_sensor_move
|
- automation.titanium_notify_on_vibration_sensor_move
|
||||||
- automation.speech_enable_when_meeting_is_over
|
- automation.speech_enable_when_meeting_is_over
|
||||||
@@ -51,6 +49,17 @@ cards:
|
|||||||
- automation.routine_coming_home_left_work
|
- automation.routine_coming_home_left_work
|
||||||
- automation.presence_leaving_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
|
- type: entities
|
||||||
title: Lighting
|
title: Lighting
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
@@ -62,13 +71,8 @@ cards:
|
|||||||
- automation.lighting_temperature_adjust_on_start
|
- automation.lighting_temperature_adjust_on_start
|
||||||
- automation.lighting_temperature_adjust_based_on_time
|
- automation.lighting_temperature_adjust_based_on_time
|
||||||
- type: divider
|
- 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_lights_on_switch_single_click
|
||||||
- automation.lighting_master_bedroom_toggle_ambient_lights_on_switch_double_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
|
- type: divider
|
||||||
- automation.lighting_kitchen_motion_on
|
- automation.lighting_kitchen_motion_on
|
||||||
- automation.lighting_kitchen_motion_off
|
- automation.lighting_kitchen_motion_off
|
||||||
@@ -97,12 +101,9 @@ cards:
|
|||||||
- automation.tv_plex_setup_house_for_plex
|
- automation.tv_plex_setup_house_for_plex
|
||||||
- automation.tv_plex_restore_house_after_plex
|
- automation.tv_plex_restore_house_after_plex
|
||||||
- automation.youtube_download_latest_pds
|
- 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_night_mode
|
||||||
- automation.media_sonos_put_beam_in_day_mode
|
- automation.media_sonos_put_beam_in_day_mode
|
||||||
- automation.media_sonos_volume_up_on_bathroom_switch_click
|
|
||||||
- type: divider
|
- type: divider
|
||||||
- automation.music_living_room_play_pause_on_desk_switch_hold
|
|
||||||
- automation.music_master_bedroom_play_pause_on_switch_hold
|
- automation.music_master_bedroom_play_pause_on_switch_hold
|
||||||
|
|
||||||
- type: entities
|
- type: entities
|
||||||
@@ -120,7 +121,6 @@ cards:
|
|||||||
- automation.house_mode_set_to_day
|
- automation.house_mode_set_to_day
|
||||||
- automation.house_mode_set_to_bed
|
- automation.house_mode_set_to_bed
|
||||||
- automation.house_mode_set_to_night
|
- 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
|
- automation.house_mode_set_to_day_if_bedroom_door_was_opened
|
||||||
|
|
||||||
- type: entities
|
- type: entities
|
||||||
|
|||||||
@@ -8,12 +8,6 @@ input_number:
|
|||||||
icon: mdi:speaker
|
icon: mdi:speaker
|
||||||
|
|
||||||
sensor:
|
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
|
- platform: mqtt
|
||||||
name: "Bathroom switch battery"
|
name: "Bathroom switch battery"
|
||||||
state_topic: "z2m_deconz/bathroom_switch"
|
state_topic: "z2m_deconz/bathroom_switch"
|
||||||
@@ -21,12 +15,6 @@ sensor:
|
|||||||
unit_of_measurement: "%"
|
unit_of_measurement: "%"
|
||||||
device_class: "battery"
|
device_class: "battery"
|
||||||
value_template: "{{ value_json.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
|
- platform: mqtt
|
||||||
name: "Bathroom switch LQI"
|
name: "Bathroom switch LQI"
|
||||||
state_topic: "z2m_deconz/bathroom_switch"
|
state_topic: "z2m_deconz/bathroom_switch"
|
||||||
@@ -36,37 +24,26 @@ sensor:
|
|||||||
value_template: "{{ value_json.linkquality }}"
|
value_template: "{{ value_json.linkquality }}"
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Media · Sonos · Volume up on bathroom switch click
|
- alias: Bathroom · Switch
|
||||||
trigger:
|
use_blueprint:
|
||||||
platform: mqtt
|
path: aqara_switch.yaml
|
||||||
topic: "z2m_deconz/bathroom_switch"
|
input:
|
||||||
condition:
|
z2m_topic: "z2m_deconz/bathroom_switch"
|
||||||
- condition: state
|
click:
|
||||||
entity_id: sensor.bathroom_switch_click
|
- service: media_player.volume_set
|
||||||
state: 'single'
|
entity_id: media_player.bathroom
|
||||||
action:
|
data_template:
|
||||||
- service: media_player.volume_set
|
volume_level: >-
|
||||||
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) %}
|
{% if state_attr('media_player.bathroom', 'volume_level')|float > (states('input_number.bathroom_high_volume')|float - 0.05) %}
|
||||||
0.25
|
0.25
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ states('input_number.bathroom_high_volume')|float }}
|
{{ states('input_number.bathroom_high_volume')|float }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
- alias: Youtube · play latest pds on bathroom switch dobule click
|
double_click:
|
||||||
trigger:
|
- service: media_player.volume_set
|
||||||
platform: mqtt
|
entity_id: media_player.bathroom
|
||||||
topic: "z2m_deconz/bathroom_switch"
|
data_template:
|
||||||
condition:
|
volume_level: "{{ states('input_number.bathroom_high_volume')|float }}"
|
||||||
- condition: state
|
- service: script.youtube_play_latest_pds
|
||||||
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
|
|
||||||
|
|||||||
@@ -22,155 +22,95 @@ sensor:
|
|||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Bedroom · Opple
|
- alias: Bedroom · Opple
|
||||||
mode: queued
|
use_blueprint:
|
||||||
trigger:
|
path: oppo_6_btn_switch.yaml
|
||||||
platform: mqtt
|
input:
|
||||||
topic: "z2m_deconz/opple_1"
|
opple_z2m_name: "z2m_deconz/opple_1"
|
||||||
action:
|
action_sensor: sensor.bedroom_opple_action
|
||||||
- choose:
|
|
||||||
- conditions:
|
button_1_single:
|
||||||
- condition: state
|
- service: light.turn_off
|
||||||
entity_id: sensor.bedroom_opple_action
|
entity_id: light.master_bedroom
|
||||||
state: 'button_1_single'
|
|
||||||
sequence:
|
button_2_single:
|
||||||
- service: light.turn_off
|
- service: light.turn_on
|
||||||
|
data_template:
|
||||||
entity_id: light.master_bedroom
|
entity_id: light.master_bedroom
|
||||||
|
brightness_pct: >-
|
||||||
|
|
||||||
- conditions:
|
{% if not is_state('input_select.house_mode', 'day') %}
|
||||||
- condition: state
|
40
|
||||||
entity_id: sensor.bedroom_opple_action
|
{% else %}
|
||||||
state: 'button_2_single'
|
100
|
||||||
sequence:
|
{% endif %}
|
||||||
- service: light.turn_on
|
|
||||||
data_template:
|
|
||||||
entity_id: light.master_bedroom
|
|
||||||
brightness_pct: >-
|
|
||||||
|
|
||||||
{% if not is_state('input_select.house_mode', 'day') %}
|
button_1_double:
|
||||||
40
|
- service: light.turn_off
|
||||||
{% else %}
|
entity_id: light.master_bedroom_main
|
||||||
100
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
- conditions:
|
button_2_double:
|
||||||
- condition: state
|
- service: light.turn_on
|
||||||
entity_id: sensor.bedroom_opple_action
|
data_template:
|
||||||
state: 'button_1_double'
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_off
|
|
||||||
entity_id: light.master_bedroom_main
|
entity_id: light.master_bedroom_main
|
||||||
|
brightness_pct: >-
|
||||||
|
|
||||||
- conditions:
|
{% if not is_state('input_select.house_mode', 'day') %}
|
||||||
- condition: state
|
40
|
||||||
entity_id: sensor.bedroom_opple_action
|
{% else %}
|
||||||
state: 'button_2_double'
|
100
|
||||||
sequence:
|
{% endif %}
|
||||||
- service: light.turn_on
|
|
||||||
data_template:
|
|
||||||
entity_id: light.master_bedroom_main
|
|
||||||
brightness_pct: >-
|
|
||||||
|
|
||||||
{% if not is_state('input_select.house_mode', 'day') %}
|
button_1_triple:
|
||||||
40
|
- service: light.turn_off
|
||||||
{% else %}
|
entity_id:
|
||||||
100
|
- light.bedside
|
||||||
{% endif %}
|
- light.bed_led
|
||||||
|
|
||||||
- conditions:
|
button_2_triple:
|
||||||
- condition: state
|
- service: light.turn_on
|
||||||
entity_id: sensor.bedroom_opple_action
|
data_template:
|
||||||
state: 'button_1_triple'
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_off
|
|
||||||
entity_id:
|
entity_id:
|
||||||
- light.bedside
|
- light.bedside
|
||||||
- light.bed_led
|
- light.bed_led
|
||||||
|
brightness_pct: >-
|
||||||
|
|
||||||
- conditions:
|
{% if not is_state('input_select.house_mode', 'day') %}
|
||||||
- condition: state
|
40
|
||||||
entity_id: sensor.bedroom_opple_action
|
{% else %}
|
||||||
state: 'button_2_triple'
|
100
|
||||||
sequence:
|
{% endif %}
|
||||||
- service: light.turn_on
|
|
||||||
data_template:
|
|
||||||
entity_id:
|
|
||||||
- light.bedside
|
|
||||||
- light.bed_led
|
|
||||||
brightness_pct: >-
|
|
||||||
|
|
||||||
{% if not is_state('input_select.house_mode', 'day') %}
|
button_3_single:
|
||||||
40
|
- service: media_player.media_play_pause
|
||||||
{% else %}
|
entity_id: media_player.master_bedroom
|
||||||
100
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
- conditions:
|
button_3_double:
|
||||||
- condition: state
|
- service: script.sonos_join_tv
|
||||||
entity_id: sensor.bedroom_opple_action
|
|
||||||
state: 'button_3_single'
|
|
||||||
sequence:
|
|
||||||
- service: media_player.media_play_pause
|
|
||||||
entity_id: media_player.master_bedroom
|
|
||||||
|
|
||||||
- conditions:
|
button_3_triple:
|
||||||
- condition: state
|
- service: script.sonos_join_bedroom
|
||||||
entity_id: sensor.bedroom_opple_action
|
|
||||||
state: 'button_3_double'
|
|
||||||
sequence:
|
|
||||||
- service: script.sonos_join_tv
|
|
||||||
|
|
||||||
- conditions:
|
button_3_release:
|
||||||
- condition: state
|
- service: media_player.play_next
|
||||||
entity_id: sensor.bedroom_opple_action
|
entity_id: media_player.master_bedroom
|
||||||
state: 'button_3_triple'
|
|
||||||
sequence:
|
|
||||||
- service: script.sonos_join_bedroom
|
|
||||||
|
|
||||||
- conditions:
|
button_4_single:
|
||||||
- condition: state
|
- service: script.music_play
|
||||||
entity_id: sensor.bedroom_opple_action
|
|
||||||
state: 'button_3_release'
|
|
||||||
sequence:
|
|
||||||
- service: media_player.play_next
|
|
||||||
entity_id: media_player.master_bedroom
|
|
||||||
|
|
||||||
- conditions:
|
button_4_double:
|
||||||
- condition: state
|
- service: script.music_play
|
||||||
entity_id: sensor.bedroom_opple_action
|
data:
|
||||||
state: 'button_4_single'
|
playlist: 'Starred'
|
||||||
sequence:
|
|
||||||
- service: script.music_play
|
|
||||||
|
|
||||||
- conditions:
|
button_4_triple:
|
||||||
- condition: state
|
- service: script.music_play
|
||||||
entity_id: sensor.bedroom_opple_action
|
data:
|
||||||
state: 'button_4_double'
|
playlist: 'Retro'
|
||||||
sequence:
|
|
||||||
- service: script.music_play
|
|
||||||
data:
|
|
||||||
playlist: 'Starred'
|
|
||||||
|
|
||||||
- conditions:
|
button_5_single:
|
||||||
- condition: state
|
- service: fan.turn_off
|
||||||
entity_id: sensor.bedroom_opple_action
|
entity_id: fan.philips_airpurifier
|
||||||
state: 'button_4_triple'
|
|
||||||
sequence:
|
|
||||||
- service: script.music_play
|
|
||||||
data:
|
|
||||||
playlist: 'Retro'
|
|
||||||
|
|
||||||
- conditions:
|
button_6_single:
|
||||||
- condition: state
|
- service: fan.turn_on
|
||||||
entity_id: sensor.bedroom_opple_action
|
entity_id: fan.philips_airpurifier
|
||||||
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
|
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
sensor:
|
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
|
- platform: mqtt
|
||||||
name: "Bedside switch battery"
|
name: "Bedside switch battery"
|
||||||
state_topic: "z2m_deconz/bedside_switch"
|
state_topic: "z2m_deconz/bedside_switch"
|
||||||
@@ -12,12 +6,6 @@ sensor:
|
|||||||
unit_of_measurement: "%"
|
unit_of_measurement: "%"
|
||||||
device_class: "battery"
|
device_class: "battery"
|
||||||
value_template: "{{ value_json.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
|
- platform: mqtt
|
||||||
name: "Bedside switch LQI"
|
name: "Bedside switch LQI"
|
||||||
state_topic: "z2m_deconz/bedside_switch"
|
state_topic: "z2m_deconz/bedside_switch"
|
||||||
@@ -27,55 +15,39 @@ sensor:
|
|||||||
value_template: "{{ value_json.linkquality }}"
|
value_template: "{{ value_json.linkquality }}"
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Lighting · Master bedroom · Toggle lights on bedside switch single click
|
- alias: Bedroom · Bedside Switch
|
||||||
trigger:
|
use_blueprint:
|
||||||
platform: mqtt
|
path: aqara_switch.yaml
|
||||||
topic: "z2m_deconz/bedside_switch"
|
input:
|
||||||
condition:
|
z2m_topic: "z2m_deconz/bedside_switch"
|
||||||
- condition: state
|
click:
|
||||||
entity_id: sensor.bedside_switch_click
|
- service: light.toggle
|
||||||
state: 'single'
|
data_template:
|
||||||
action:
|
entity_id: >-
|
||||||
- service: light.toggle
|
|
||||||
data_template:
|
|
||||||
entity_id: >-
|
|
||||||
|
|
||||||
{% if is_state('input_select.house_mode', 'day') %}
|
{% if is_state('input_select.house_mode', 'day') %}
|
||||||
light.master_bedroom_main
|
light.master_bedroom_main
|
||||||
{% elif is_state('input_select.house_mode', 'bed') %}
|
{% elif is_state('input_select.house_mode', 'bed') %}
|
||||||
light.bedside, light.bed_led
|
light.bedside, light.bed_led
|
||||||
{% elif is_state('input_select.house_mode', 'night') %}
|
{% elif is_state('input_select.house_mode', 'night') %}
|
||||||
light.bed_led
|
light.bed_led
|
||||||
{% endif %}
|
{% endif %}
|
||||||
brightness_pct: >-
|
brightness_pct: >-
|
||||||
|
|
||||||
{% if is_state('input_select.house_mode', 'night') %}
|
{% if is_state('input_select.house_mode', 'night') %}
|
||||||
40
|
40
|
||||||
{% else %}
|
{% else %}
|
||||||
100
|
100
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
- alias: Lighting · Master bedroom · Toggle ambient lights on bedside switch double click
|
double_click:
|
||||||
trigger:
|
- service: light.toggle
|
||||||
platform: mqtt
|
data_template:
|
||||||
topic: "z2m_deconz/bedside_switch"
|
entity_id:
|
||||||
condition:
|
- light.bedside
|
||||||
- condition: state
|
- light.bed_led
|
||||||
entity_id: sensor.bedside_switch_click
|
brightness_pct: 100
|
||||||
state: 'double'
|
|
||||||
action:
|
|
||||||
- service: light.toggle
|
|
||||||
data_template:
|
|
||||||
entity_id:
|
|
||||||
- light.bedside
|
|
||||||
- light.bed_led
|
|
||||||
brightness_pct: 100
|
|
||||||
|
|
||||||
- alias: House mode · Toggle on bedside switch hold
|
hold:
|
||||||
trigger:
|
- service: input_select.select_next
|
||||||
platform: state
|
entity_id: input_select.house_mode
|
||||||
entity_id: sensor.bedside_switch_action
|
|
||||||
to: 'hold'
|
|
||||||
action:
|
|
||||||
- service: input_select.select_next
|
|
||||||
entity_id: input_select.house_mode
|
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
sensor:
|
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
|
- platform: mqtt
|
||||||
name: "Desk switch battery"
|
name: "Desk switch battery"
|
||||||
state_topic: "z2m_deconz/desk_switch"
|
state_topic: "z2m_deconz/desk_switch"
|
||||||
@@ -12,12 +6,6 @@ sensor:
|
|||||||
unit_of_measurement: "%"
|
unit_of_measurement: "%"
|
||||||
device_class: "battery"
|
device_class: "battery"
|
||||||
value_template: "{{ value_json.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
|
- platform: mqtt
|
||||||
name: "Desk switch LQI"
|
name: "Desk switch LQI"
|
||||||
state_topic: "z2m_deconz/desk_switch"
|
state_topic: "z2m_deconz/desk_switch"
|
||||||
@@ -28,51 +16,35 @@ sensor:
|
|||||||
|
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Lighting · Living Room · Toggle ceiling lights on desk switch single click
|
- alias: Living room · Desk switch
|
||||||
trigger:
|
use_blueprint:
|
||||||
platform: mqtt
|
path: aqara_switch.yaml
|
||||||
topic: "z2m_deconz/desk_switch"
|
input:
|
||||||
condition:
|
z2m_topic: "z2m_deconz/desk_switch"
|
||||||
- condition: state
|
click:
|
||||||
entity_id: sensor.desk_switch_click
|
- service: light.toggle
|
||||||
state: 'single'
|
data_template:
|
||||||
action:
|
entity_id: light.living_room_main
|
||||||
- service: light.toggle
|
brightness_pct: >-
|
||||||
data_template:
|
|
||||||
entity_id: light.living_room_main
|
|
||||||
brightness_pct: >-
|
|
||||||
|
|
||||||
{% if is_state('input_select.house_mode', 'night') %}
|
{% if is_state('input_select.house_mode', 'night') %}
|
||||||
40
|
40
|
||||||
{% else %}
|
{% else %}
|
||||||
100
|
100
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
- alias: Lighting · Living Room · Toggle ambient lights on desk switch double click
|
double_click:
|
||||||
trigger:
|
- service: light.toggle
|
||||||
platform: mqtt
|
data_template:
|
||||||
topic: "z2m_deconz/desk_switch"
|
entity_id: light.living_room_ambient
|
||||||
condition:
|
brightness_pct: >-
|
||||||
- condition: state
|
|
||||||
entity_id: sensor.desk_switch_click
|
|
||||||
state: 'double'
|
|
||||||
action:
|
|
||||||
- service: light.toggle
|
|
||||||
data_template:
|
|
||||||
entity_id: light.living_room_ambient
|
|
||||||
brightness_pct: >-
|
|
||||||
|
|
||||||
{% if is_state('input_select.house_mode', 'night') %}
|
{% if is_state('input_select.house_mode', 'night') %}
|
||||||
40
|
40
|
||||||
{% else %}
|
{% else %}
|
||||||
100
|
100
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
- alias: Music · Living Room · Play pause on desk switch hold
|
hold:
|
||||||
trigger:
|
- service: media_player.media_play_pause
|
||||||
platform: state
|
entity_id: media_player.living_room
|
||||||
entity_id: sensor.desk_switch_action
|
|
||||||
to: 'hold'
|
|
||||||
action:
|
|
||||||
- service: media_player.media_play_pause
|
|
||||||
entity_id: media_player.living_room
|
|
||||||
|
|||||||
@@ -22,188 +22,112 @@ sensor:
|
|||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Living room · Opple
|
- alias: Living room · Opple
|
||||||
mode: queued
|
use_blueprint:
|
||||||
trigger:
|
path: oppo_6_btn_switch.yaml
|
||||||
platform: mqtt
|
input:
|
||||||
topic: "z2m_deconz/opple_2"
|
opple_z2m_name: "z2m_deconz/opple_2"
|
||||||
action:
|
action_sensor: sensor.living_room_opple_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
|
|
||||||
|
|
||||||
- conditions:
|
button_1_single:
|
||||||
- condition: state
|
- service: light.turn_off
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: light.living_room
|
||||||
state: 'button_2_single'
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_on
|
|
||||||
entity_id: light.living_room
|
|
||||||
|
|
||||||
- conditions:
|
button_2_single:
|
||||||
- condition: state
|
- service: light.turn_on
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: light.living_room
|
||||||
state: 'button_1_double'
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_off
|
|
||||||
entity_id: light.living_room_main
|
|
||||||
|
|
||||||
- conditions:
|
button_1_double:
|
||||||
- condition: state
|
- service: light.turn_off
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: light.living_room_main
|
||||||
state: 'button_2_double'
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_on
|
|
||||||
entity_id: light.living_room_main
|
|
||||||
|
|
||||||
- conditions:
|
button_2_double:
|
||||||
- condition: state
|
- service: light.turn_on
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: light.living_room_main
|
||||||
state: 'button_1_triple'
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_off
|
|
||||||
entity_id: light.living_room_ambient
|
|
||||||
|
|
||||||
- conditions:
|
button_1_triple:
|
||||||
- condition: state
|
- service: light.turn_off
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: light.living_room_ambient
|
||||||
state: 'button_2_triple'
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_on
|
|
||||||
entity_id: light.living_room_ambient
|
|
||||||
|
|
||||||
- conditions:
|
button_2_triple:
|
||||||
- condition: state
|
- service: light.turn_on
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: light.living_room_ambient
|
||||||
state: 'button_2_release'
|
|
||||||
sequence:
|
|
||||||
- service: script.scene_living_room_ambient_neon
|
|
||||||
|
|
||||||
- conditions:
|
button_2_release:
|
||||||
- condition: state
|
- service: script.scene_living_room_ambient_neon
|
||||||
entity_id: sensor.living_room_opple_action
|
|
||||||
state: 'button_3_single'
|
|
||||||
sequence:
|
|
||||||
- service: media_player.media_play_pause
|
|
||||||
entity_id: media_player.living_room
|
|
||||||
|
|
||||||
- conditions:
|
button_3_single:
|
||||||
- condition: state
|
- service: media_player.media_play_pause
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: media_player.living_room
|
||||||
state: 'button_3_double'
|
|
||||||
sequence:
|
|
||||||
- service: script.sonos_join_tv
|
|
||||||
|
|
||||||
- conditions:
|
button_3_double:
|
||||||
- condition: state
|
- service: script.sonos_join_tv
|
||||||
entity_id: sensor.living_room_opple_action
|
|
||||||
state: 'button_3_triple'
|
|
||||||
sequence:
|
|
||||||
- service: script.sonos_join_bedroom
|
|
||||||
|
|
||||||
- conditions:
|
button_3_triple:
|
||||||
- condition: state
|
- service: script.sonos_join_bedroom
|
||||||
entity_id: sensor.living_room_opple_action
|
|
||||||
state: 'button_3_release'
|
|
||||||
sequence:
|
|
||||||
- service: media_player.play_next
|
|
||||||
entity_id: media_player.living_room
|
|
||||||
|
|
||||||
- conditions:
|
button_3_release:
|
||||||
- condition: state
|
- service: media_player.play_next
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: media_player.living_room
|
||||||
state: 'button_4_single'
|
|
||||||
sequence:
|
|
||||||
- service: script.music_play
|
|
||||||
|
|
||||||
- conditions:
|
button_4_single:
|
||||||
- condition: state
|
- service: script.music_play
|
||||||
entity_id: sensor.living_room_opple_action
|
|
||||||
state: 'button_4_double'
|
|
||||||
sequence:
|
|
||||||
- service: script.music_play
|
|
||||||
data:
|
|
||||||
playlist: 'Starred'
|
|
||||||
|
|
||||||
- conditions:
|
button_4_double:
|
||||||
- condition: state
|
- service: script.music_play
|
||||||
entity_id: sensor.living_room_opple_action
|
data:
|
||||||
state: 'button_4_triple'
|
playlist: 'Starred'
|
||||||
sequence:
|
|
||||||
- service: script.music_play
|
|
||||||
data:
|
|
||||||
playlist: 'Retro'
|
|
||||||
|
|
||||||
- conditions:
|
button_4_triple:
|
||||||
- condition: state
|
- service: script.music_play
|
||||||
entity_id: sensor.living_room_opple_action
|
data:
|
||||||
state: 'button_5_single'
|
playlist: 'Retro'
|
||||||
sequence:
|
|
||||||
- service: climate.turn_off
|
|
||||||
entity_id: climate.toshiba_ac
|
|
||||||
|
|
||||||
- conditions:
|
button_5_single:
|
||||||
- condition: state
|
- service: climate.turn_off
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: climate.toshiba_ac
|
||||||
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}}"
|
|
||||||
|
|
||||||
- conditions:
|
button_5_double:
|
||||||
- condition: state
|
- service: climate.set_temperature
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: climate.toshiba_ac
|
||||||
state: 'button_6_single'
|
data_template:
|
||||||
sequence:
|
temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int -1}}"
|
||||||
- service: script.toshiba_ac_on_cool
|
|
||||||
|
|
||||||
- conditions:
|
button_6_single:
|
||||||
- condition: state
|
- service: script.toshiba_ac_on_cool
|
||||||
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}}"
|
|
||||||
|
|
||||||
- conditions:
|
button_6_double:
|
||||||
- condition: state
|
- service: climate.set_temperature
|
||||||
entity_id: sensor.living_room_opple_action
|
entity_id: climate.toshiba_ac
|
||||||
state: 'button_6_triple'
|
data_template:
|
||||||
sequence:
|
temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int +1}}"
|
||||||
- service: automation.turn_off
|
|
||||||
entity_id: automation.tv_sonos_join_tv_on_google_cast
|
|
||||||
|
|
||||||
- service: script.tv_fireplace
|
button_6_triple:
|
||||||
|
- service: automation.turn_off
|
||||||
|
entity_id: automation.tv_sonos_join_tv_on_google_cast
|
||||||
|
|
||||||
- service: sonos.join
|
- service: script.tv_fireplace
|
||||||
entity_id:
|
|
||||||
- media_player.kitchen
|
|
||||||
- media_player.bathroom
|
|
||||||
data:
|
|
||||||
master: media_player.master_bedroom
|
|
||||||
|
|
||||||
# Music play, without the join
|
- service: sonos.join
|
||||||
- service: media_player.volume_set
|
entity_id:
|
||||||
entity_id: media_player.master_bedroom
|
- media_player.kitchen
|
||||||
data:
|
- media_player.bathroom
|
||||||
volume_level: 0.2
|
data:
|
||||||
- service: media_player.shuffle_set
|
master: media_player.master_bedroom
|
||||||
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
|
# Music play, without the join
|
||||||
- service: automation.turn_on
|
- service: media_player.volume_set
|
||||||
entity_id: automation.tv_sonos_join_tv_on_google_cast
|
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