Reduce and refactor automations

This commit is contained in:
Georgi Gardev
2022-12-01 16:02:00 +02:00
parent c35975492f
commit d58a40a0c2
12 changed files with 174 additions and 334 deletions
+1 -3
View File
@@ -16,9 +16,7 @@ group:
- automation.music_living_room_play_pause_on_desk_switch_hold
- automation.music_master_bedroom_play_pause_on_switch_hold
- automation.notification_door_opened
- automation.bedroom_mode_set_to_night
- automation.bedroom_mode_set_to_bed
- automation.bedroom_mode_set_to_day
- automation.bedroom_mode_change
- automation.bedroom_mode_toggle_on_bedside_switch_hold
- automation.security_door_opened_while_away
- automation.purifier_turn_on_low_humidity
+18 -61
View File
@@ -7,68 +7,25 @@ input_boolean:
icon: mdi:cogs
automation:
- alias: Guest mode · Enable
- alias: Guest mode · Change
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "off"
to: "on"
action:
- service: automation.turn_off
entity_id:
- automation.presence_leaving_home
- automation.presence_coming_home
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- alias: Guest mode · Disable
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "on"
to: "off"
action:
- service: automation.turn_on
entity_id:
- automation.presence_leaving_home
- automation.presence_coming_home
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
- alias: Guest mode · Enable · From Telegram
trigger:
platform: event
event_type: telegram_command
event_data:
command: "/guest_mode_on"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.guest_mode
- service: notify.telegram
data:
title: "⚙️ *System Module · Telegram*"
message: "Okay, turning Guest mode on!"
- service: logbook.log
data:
name: "⚙️ System Module · "
message: "Telegram · Turning Guest mode on"
domain: input_boolean
- alias: Guest mode · Disable · From Telegram
trigger:
platform: event
event_type: telegram_command
event_data:
command: "/guest_mode_off"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.guest_mode
- service: notify.telegram
data:
title: "⚙️ *System Module · Telegram*"
message: "Okay, turning Guest mode off!"
- service: logbook.log
data:
name: "⚙️ System Module · "
message: "Telegram · Turning Guest mode off"
domain: input_boolean
choose:
- conditions: "{{ trigger.to_state == 'on' }}"
sequence:
- service: automation.turn_off
entity_id:
- automation.presence_leaving_home
- automation.presence_coming_home
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- conditions: "{{ trigger.to_state == 'off' }}"
sequence:
- service: automation.turn_on
entity_id:
- automation.presence_leaving_home
- automation.presence_coming_home
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
+19 -30
View File
@@ -71,29 +71,21 @@ script:
option: "{{ is_state('input_select.bedroom_mode', 'day') | iif('night', 'day') }}"
automation:
- alias: Bedroom mode · Set to day
- alias: Bedroom mode · Change
trigger:
platform: state
entity_id: input_select.bedroom_mode
to: "day"
action:
- service: script.routine_bedroom_morning
- alias: Bedroom mode · Set to bed
trigger:
platform: state
entity_id: input_select.bedroom_mode
to: "bed"
action:
- service: script.routine_bedroom_bedtime
- alias: Bedroom mode · Set to night
trigger:
platform: state
entity_id: input_select.bedroom_mode
to: "night"
action:
- service: script.bedroom_good_night
- choose:
- conditions: "{{ trigger.to_state == 'day' }}"
sequence:
- service: script.routine_bedroom_morning
- conditions: "{{ trigger.to_state == 'bed' }}"
sequence:
- service: script.routine_bedroom_bedtime
- conditions: "{{ trigger.to_state == 'night' }}"
sequence:
- service: script.bedroom_good_night
- alias: Guest Bedroom mode · Set to night
trigger:
@@ -104,18 +96,15 @@ automation:
- service: light.turn_off
entity_id: light.tradfri_large
- alias: House mode · Set to day
- alias: House mode · Change
trigger:
platform: state
entity_id: sensor.house_mode
to: "day"
action:
- service: script.routine_waking_up
- alias: House mode · Set to night
trigger:
platform: state
entity_id: sensor.house_mode
to: "night"
action:
- service: script.routine_good_night
choose:
- conditions: "{{ trigger.to_state == 'day' }}"
sequence:
- service: script.routine_waking_up
- conditions: "{{ trigger.to_state == 'night' }}"
sequence:
- service: script.routine_good_night