From dc097c7d1ff5024f537eeacd96bf0e5e56d1fe3c Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Mon, 11 Jan 2021 01:33:46 +0100 Subject: [PATCH] Change automations based on home state --- automations/files/bathroom-motion.yaml | 60 +++++++++++++++++++++----- automations/files/hallway-motion.yaml | 32 +++++++++++++- automations/files/scripts/modes.yaml | 43 ++++++++++++++++++ 3 files changed, 123 insertions(+), 12 deletions(-) create mode 100644 automations/files/scripts/modes.yaml diff --git a/automations/files/bathroom-motion.yaml b/automations/files/bathroom-motion.yaml index 6a26f7e..22d7207 100644 --- a/automations/files/bathroom-motion.yaml +++ b/automations/files/bathroom-motion.yaml @@ -1,18 +1,59 @@ -- id: bathroom-motion-on - alias: '[Bathroom] Motion On' +- id: bathroom-motion-day + alias: '[Bathroom] Motion Day' mode: restart trigger: - platform: state entity_id: binary_sensor.bathroom_motion_sensor from: 'off' to: 'on' + condition: + - condition: state + entity_id: input_select.home_mode + state: Day + action: + - service: light.turn_on + entity_id: light.bathroom_lights + data: + brightness: 100 + kelvin: 2000 +- id: bathroom-motion-party + alias: '[Bathroom] Motion Party' + mode: restart + trigger: + - platform: state + entity_id: binary_sensor.bathroom_motion_sensor + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: input_select.home_mode + state: Party action: - service: light.turn_on entity_id: - - light.bathroom_1 - - light.bathroom_2 - - light.bathroom_3 - - light.bathroom_4 + - light.bathroom_lights + - light.bathroom_mirror_lights + data: + brightness: 100 + kelvin: 2000 +- id: bathroom-motion-night + alias: '[Bathroom] Motion Night' + mode: restart + trigger: + - platform: state + entity_id: binary_sensor.bathroom_motion_sensor + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: input_select.home_mode + state: Night + action: + - service: light.turn_on + entity_id: light.bathroom_lights + data: + brightness: 5 + kelvin: 3200 - id: bathroom-motion-off alias: '[Bathroom] Motion Off' mode: restart @@ -25,7 +66,6 @@ action: - service: light.turn_off entity_id: - - light.bathroom_1 - - light.bathroom_2 - - light.bathroom_3 - - light.bathroom_4 + - light.bathroom_lights + - light.bathroom_mirror_lights + - light.bathroom_minor_lights diff --git a/automations/files/hallway-motion.yaml b/automations/files/hallway-motion.yaml index 59c4829..8f74ea2 100644 --- a/automations/files/hallway-motion.yaml +++ b/automations/files/hallway-motion.yaml @@ -1,14 +1,42 @@ -- id: hallway-motion-on - alias: '[Hallway] Motion On' +- id: hallway-motion-day + alias: '[Hallway] Motion Day' mode: restart trigger: - platform: state entity_id: binary_sensor.hallway_motion_sensor from: 'off' to: 'on' + condition: + - condition: state + entity_id: input_select.home_mode + state: Day action: - service: light.turn_on entity_id: light.hallway_lightstrip + data: + brightness: 100 + kelvin: 2000 +- id: hallway-motion-night + alias: '[Hallway] Motion Night' + mode: restart + trigger: + - platform: state + entity_id: binary_sensor.hallway_motion_sensor + from: 'off' + to: 'on' + condition: + - condition: state + entity_id: input_select.home_mode + state: Night + action: + - service: light.turn_on + entity_id: light.hallway_lightstrip + data: + brightness: 5 + rgb_color: + - 255 + - 0 + - 0 - id: hallway-motion-off alias: '[Hallway] Motion Off' mode: restart diff --git a/automations/files/scripts/modes.yaml b/automations/files/scripts/modes.yaml new file mode 100644 index 0000000..8920aa7 --- /dev/null +++ b/automations/files/scripts/modes.yaml @@ -0,0 +1,43 @@ +- alias: Goodnight + sequence: + - service: light.turn_off + entity_id: + - light.desk_lamp + - light.computer_lights + - light.tv_lights + - light.couch_lamp + - light.table_lamp + - light.kitchen_lights + - light.kitchen_sink_lighstrip + - light.bathroom_lights + - light.shower_lights + - light.bathroom_mirror_lights + - light.bathroom_minor_lights + - light.bedroom_lights + - light.bed_lightstrip + - light.bed_lamp + - light.hallway_light + - light.hallway_lightstrip + - service: alarm_control_panel.alarm_arm_night + entity_id: alarm_control_panel.ha_alarm + - service: switch.turn_off + entity_id: + - switch.computer_outlet + - service: input_select.select_option + data: + option: Night + entity_id: input_select.home_mode + mode: single + icon: 'mdi:weather-night' +- alias: Goodmorning + sequence: + - service: alarm_control_panel.alarm_arm_night + entity_id: alarm_control_panel.ha_alarm + - service: input_select.select_option + data: + option: Day + entity_id: input_select.home_mode + - service: switch.turn_on + data: { } + entity_id: switch.computer_outlet + mode: single