diff --git a/automation/domestina.yaml b/automation/domestina.yaml new file mode 100644 index 0000000..cf96969 --- /dev/null +++ b/automation/domestina.yaml @@ -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 diff --git a/automation/guest_mode.yaml b/automation/guest_mode.yaml new file mode 100644 index 0000000..3b4f8f4 --- /dev/null +++ b/automation/guest_mode.yaml @@ -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 diff --git a/automation/magic_cube.yaml b/automation/magic_cube.yaml new file mode 100644 index 0000000..57bbab9 --- /dev/null +++ b/automation/magic_cube.yaml @@ -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 diff --git a/automation/presence.yaml b/automation/presence.yaml new file mode 100644 index 0000000..4ac794e --- /dev/null +++ b/automation/presence.yaml @@ -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 diff --git a/automation/sleep_mode.yaml b/automation/sleep_mode.yaml new file mode 100644 index 0000000..1947d6b --- /dev/null +++ b/automation/sleep_mode.yaml @@ -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 diff --git a/automation/startup.yaml b/automation/startup.yaml new file mode 100644 index 0000000..0819fdf --- /dev/null +++ b/automation/startup.yaml @@ -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 diff --git a/automations.yaml b/automations.yaml deleted file mode 100644 index a848ffe..0000000 --- a/automations.yaml +++ /dev/null @@ -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 diff --git a/configuration.yaml b/configuration.yaml index 07c3e71..76b93f0 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -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