Split automations

This commit is contained in:
2020-03-04 23:49:15 +02:00
parent f290470e9e
commit 379a45afa2
8 changed files with 202 additions and 217 deletions
+49
View File
@@ -0,0 +1,49 @@
- alias: Trigger Domestina Start
trigger:
platform: time
at: "08:30:00"
condition:
- condition: time
weekday: thu
action:
- service: input_boolean.turn_on
entity_id: input_boolean.domestina
- alias: On Domestina Start
trigger:
platform: state
entity_id: input_boolean.domestina
from: "off"
to: "on"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.guest_mode
- service: automation.turn_off
entity_id: automation.cube_knock
- service: automation.turn_off
entity_id: automation.cube_shake
- alias: Trigger Domestina End
trigger:
platform: time
at: "13:00:00"
condition:
- condition: time
weekday: thu
action:
- service: input_boolean.turn_off
entity_id: input_boolean.domestina
- alias: On Domestina End
trigger:
platform: state
entity_id: input_boolean.domestina
from: "on"
to: "off"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.guest_mode
- service: automation.turn_on
entity_id: automation.cube_knock
- service: automation.turn_on
entity_id: automation.cube_shake
+29
View File
@@ -0,0 +1,29 @@
- id: enable_guest_mode
alias: Enable Guest Mode
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "off"
to: "on"
action:
- service: automation.turn_off
entity_id: automation.leaving_home
- service: automation.turn_off
entity_id: automation.coming_home
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- id: disable_guest_mode
alias: Disable Guest Mode
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "on"
to: "off"
action:
- service: automation.turn_on
entity_id: automation.leaving_home
- service: automation.turn_on
entity_id: automation.coming_home
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
+19
View File
@@ -0,0 +1,19 @@
- id: cube_knock
alias: Go to bed on Cube Knock
trigger:
platform: state
entity_id: sensor.cube_multistate_input
to: "knock"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.sleep_mode
- id: cube_shake
alias: Wake up on Cube Shake
trigger:
platform: state
entity_id: sensor.cube_multistate_input
to: "shake"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.sleep_mode
+44
View File
@@ -0,0 +1,44 @@
- id: leaving_home
alias: Leaving home
trigger:
platform: state
entity_id: person.georgi
to: "not_home"
action:
- service: script.security_camera_on
- service: media_player.turn_off
entity_id: media_player.living_room_tv
- service: media_player.turn_off
entity_id: media_player.living_room_tv_2
- service: light.turn_off
entity_id: light.living_room_all_lights
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- id: coming_home
alias: Coming home
trigger:
platform: state
entity_id: person.georgi
to: "home"
action:
- service: script.security_camera_off
- service: light.turn_on
entity_id: light.living_room_all_lights
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
- alias: Play welcome music when I come back
trigger:
platform: state
entity_id: person.georgi
to: "home"
action:
- service: media_player.turn_on
entity_id: media_player.living_room_tv_2
- delay: "00:00:10"
- service: spotcast.start
data:
device_name: "Living Room TV"
uri: "spotify:playlist:1dstTefWFQaBFTC6CjcEHd"
random_song: true
+51
View File
@@ -0,0 +1,51 @@
- id: enable_sleep_mode
alias: Enable Sleep Mode
trigger:
platform: state
entity_id: input_boolean.sleep_mode
from: "off"
to: "on"
action:
- service: media_player.media_stop
entity_id: media_player.master_bedroom
- service: fan.turn_on
entity_id: fan.philips_airpurifier
- service: media_player.turn_off
entity_id: media_player.living_room_tv
- service: media_player.turn_off
entity_id: media_player.living_room_tv_2
- service: light.turn_off
entity_id: light.living_room_all_lights
- delay: "00:00:02"
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.1
- service: script.say_discretely
data:
message: "Entering sleep mode. Good night!"
- id: disable_sleep_mode
alias: Disable Sleep Mode
trigger:
platform: state
entity_id: input_boolean.sleep_mode
from: "on"
to: "off"
action:
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.3
- service: script.sarah_briefing
- delay: "00:00:25"
- service: script.sarah_talk
data:
message: "Here's some music to start the day!"
- delay: "00:00:02"
- service: media_player.select_source
entity_id: media_player.master_bedroom
data:
source: "Evening Chill"
- service: fan.turn_off
entity_id: fan.philips_airpurifier
+9
View File
@@ -0,0 +1,9 @@
# Hack - the switch.camera initial state is wrong (ON) when the server starts.
- id: hass_startup
alias: "Hass startup"
trigger:
- platform: homeassistant
event: start
action:
- service: switch.turn_off
entity_id: switch.camera
-216
View File
@@ -1,216 +0,0 @@
# https://www.home-assistant.io/integrations/automation
#
# ─── PUBLIC ─────────────────────────────────────────────────────────────────────
#
- id: cube_knock
alias: Go to bed on Cube Knock
trigger:
platform: state
entity_id: sensor.cube_multistate_input
to: "knock"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.sleep_mode
- id: cube_shake
alias: Wake up on Cube Shake
trigger:
platform: state
entity_id: sensor.cube_multistate_input
to: "shake"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.sleep_mode
- id: leaving_home
alias: Leaving home
trigger:
platform: state
entity_id: person.georgi
to: "not_home"
action:
- service: script.security_camera_on
- service: media_player.turn_off
entity_id: media_player.living_room_tv
- service: media_player.turn_off
entity_id: media_player.living_room_tv_2
- service: light.turn_off
entity_id: light.living_room_all_lights
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- id: coming_home
alias: Coming home
trigger:
platform: state
entity_id: person.georgi
to: "home"
action:
- service: script.security_camera_off
- service: light.turn_on
entity_id: light.living_room_all_lights
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
- alias: Play welcome music when I come back
trigger:
platform: state
entity_id: person.georgi
to: "home"
action:
- service: media_player.turn_on
entity_id: media_player.living_room_tv_2
- delay: "00:00:10"
- service: spotcast.start
data:
device_name: "Living Room TV"
uri: "spotify:playlist:1dstTefWFQaBFTC6CjcEHd"
random_song: true
#
# ─── PRIVATE ────────────────────────────────────────────────────────────────────
#
# Hack - the switch.camera initial state is wrong (ON) when the server starts.
- id: hass_startup
alias: "Hass startup"
trigger:
- platform: homeassistant
event: start
action:
- service: switch.turn_off
entity_id: switch.camera
- id: enable_guest_mode
alias: Enable Guest Mode
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "off"
to: "on"
action:
- service: automation.turn_off
entity_id: automation.leaving_home
- service: automation.turn_off
entity_id: automation.coming_home
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- id: disable_guest_mode
alias: Disable Guest Mode
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "on"
to: "off"
action:
- service: automation.turn_on
entity_id: automation.leaving_home
- service: automation.turn_on
entity_id: automation.coming_home
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
- id: enable_sleep_mode
alias: Enable Sleep Mode
trigger:
platform: state
entity_id: input_boolean.sleep_mode
from: "off"
to: "on"
action:
- service: media_player.media_stop
entity_id: media_player.master_bedroom
- service: fan.turn_on
entity_id: fan.philips_airpurifier
- service: media_player.turn_off
entity_id: media_player.living_room_tv
- service: media_player.turn_off
entity_id: media_player.living_room_tv_2
- service: light.turn_off
entity_id: light.living_room_all_lights
- delay: "00:00:02"
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.1
- service: script.say_discretely
data:
message: "Entering sleep mode. Good night!"
- id: disable_sleep_mode
alias: Disable Sleep Mode
trigger:
platform: state
entity_id: input_boolean.sleep_mode
from: "on"
to: "off"
action:
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.3
- service: script.sarah_briefing
- delay: "00:00:25"
- service: script.sarah_talk
data:
message: "Here's some music to start the day!"
- delay: "00:00:02"
- service: media_player.select_source
entity_id: media_player.master_bedroom
data:
source: "Evening Chill"
- service: fan.turn_off
entity_id: fan.philips_airpurifier
- alias: Trigger Domestina Start
trigger:
platform: time
at: "08:30:00"
condition:
- condition: time
weekday: thu
action:
- service: input_boolean.turn_on
entity_id: input_boolean.domestina
- alias: On Domestina Start
trigger:
platform: state
entity_id: input_boolean.domestina
from: "off"
to: "on"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.guest_mode
- service: automation.turn_off
entity_id: automation.cube_knock
- service: automation.turn_off
entity_id: automation.cube_shake
- alias: Trigger Domestina End
trigger:
platform: time
at: "13:00:00"
condition:
- condition: time
weekday: thu
action:
- service: input_boolean.turn_off
entity_id: input_boolean.domestina
- alias: On Domestina End
trigger:
platform: state
entity_id: input_boolean.domestina
from: "on"
to: "off"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.guest_mode
- service: automation.turn_on
entity_id: automation.cube_knock
- service: automation.turn_on
entity_id: automation.cube_shake
+1 -1
View File
@@ -64,7 +64,7 @@ amcrest:
- online
# https://www.home-assistant.io/integrations/automation
automation: !include automations.yaml
automation: !include_dir_merge_list automation
# https://www.home-assistant.io/integrations/binary_sensor
binary_sensor: !include binary_sensor.yaml