diff --git a/configuration/automations/bathroom-button.yaml b/configuration/automations/bathroom-button.yaml deleted file mode 100644 index 9400faf..0000000 --- a/configuration/automations/bathroom-button.yaml +++ /dev/null @@ -1,76 +0,0 @@ -- id: button-bathroom-on-off - alias: '[Bathroom] Button On/Off' - trigger: - - device_id: 0c23a8e92f43f628e584dc1805c6915e - domain: zha - platform: device - type: remote_button_short_press - subtype: turn_on - action: - - choose: - - conditions: - - condition: state - entity_id: light.bathroom_lights - state: 'on' - sequence: - - service: light.turn_off - entity_id: light.bathroom_lights - - service: light.turn_off - entity_id: light.bathroom_mirror_lights - - service: light.turn_off - entity_id: light.shower_lights - - service: light.turn_off - entity_id: light.bathroom_color_zha_group_0x0007 - - service: media_player.turn_off - entity_id: media_player.bathroom_speaker - - conditions: - - condition: state - entity_id: light.bathroom_lights - state: 'off' - sequence: - - choose: - - conditions: - - condition: state - entity_id: input_select.home_mode - state: Day - sequence: - - choose: - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'on' - sequence: - - service: light.turn_on - entity_id: light.bathroom_lights - data: - brightness: 255 - - service: light.turn_on - entity_id: light.bathroom_lights - data: - kelvin: 2000 - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'off' - sequence: - - service: light.turn_on - entity_id: light.bathroom_lights - data: - kelvin: 3200 - - service: light.turn_on - entity_id: light.bathroom_lights - data: - brightness: 255 - - conditions: - - condition: state - entity_id: input_select.home_mode - state: Night - sequence: - - service: light.turn_on - entity_id: light.bathroom_color_zha_group_0x0007 - data: - brightness_pct: 5 - hs_color: - - 360 - - 100 - mode: single \ No newline at end of file diff --git a/configuration/automations/bathroom-lights.yaml b/configuration/automations/bathroom-lights.yaml index 30738b8..a352101 100644 --- a/configuration/automations/bathroom-lights.yaml +++ b/configuration/automations/bathroom-lights.yaml @@ -8,51 +8,7 @@ entity_id: binary_sensor.bathroom_door_open_close to: 'on' action: - - choose: - - conditions: - - condition: state - entity_id: input_select.home_mode - state: Day - sequence: - - choose: - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'on' - sequence: - - service: light.turn_on - entity_id: light.bathroom_lights - data: - brightness: 255 - - service: light.turn_on - entity_id: light.bathroom_lights - data: - kelvin: 2000 - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'off' - sequence: - - service: light.turn_on - entity_id: light.bathroom_lights - data: - brightness: 255 - - service: light.turn_on - entity_id: light.bathroom_lights - data: - kelvin: 3200 - - conditions: - - condition: state - entity_id: input_select.home_mode - state: Night - sequence: - - service: light.turn_on - entity_id: light.bathroom_color_zha_group_0x0007 - data: - brightness_pct: 5 - hs_color: - - 360 - - 100 + - service: script.bathroom_lights_on mode: single - id: bathroom-lights-off @@ -79,11 +35,16 @@ for: '0:02:00' state: 'off' action: - - service: light.turn_off - entity_id: light.bathroom_lights - - service: light.turn_off - entity_id: light.bathroom_mirror_lights - - service: light.turn_off - entity_id: light.shower_lights - - service: light.turn_off - entity_id: light.bathroom_color_zha_group_0x0007 + - service: script.bathroom_lights_off + +- id: button-bathroom-on-off + alias: '[Bathroom] Button On/Off' + trigger: + - device_id: 0c23a8e92f43f628e584dc1805c6915e + domain: zha + platform: device + type: remote_button_short_press + subtype: turn_on + action: + - service: script.bathroom_lights_toggle + mode: single \ No newline at end of file diff --git a/configuration/automations/bathroom-mirror-button.yaml b/configuration/automations/bathroom-mirror-button.yaml index 1b4685a..3e76944 100644 --- a/configuration/automations/bathroom-mirror-button.yaml +++ b/configuration/automations/bathroom-mirror-button.yaml @@ -21,38 +21,5 @@ type: remote_button_short_press subtype: turn_off action: - - choose: - - conditions: - - condition: state - entity_id: light.bathroom_mirror_lights - state: 'on' - sequence: - - service: light.turn_off - entity_id: light.bathroom_mirror_lights - - conditions: - - condition: state - entity_id: light.bathroom_mirror_lights - state: 'off' - sequence: - - choose: - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'on' - sequence: - - service: light.turn_on - entity_id: light.bathroom_mirror_lights - data: - brightness_pct: 100 - kelvin: 2000 - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'off' - sequence: - - service: light.turn_on - entity_id: light.bathroom_mirror_lights - data: - brightness_pct: 100 - kelvin: 3200 + - service: script.bathroom_mirror_lights_toggle mode: single diff --git a/configuration/automations/bathroom-music.yaml b/configuration/automations/bathroom-music.yaml index 65cc859..adc72d5 100644 --- a/configuration/automations/bathroom-music.yaml +++ b/configuration/automations/bathroom-music.yaml @@ -45,5 +45,5 @@ entity_id: binary_sensor.bathroom_motion_occupancy state: 'off' action: - - service: media_player.turn_off + - service: media_player.media_pause entity_id: media_player.bathroom_speaker diff --git a/configuration/automations/bathroom-shower-motion.yaml b/configuration/automations/bathroom-shower-motion.yaml index f724849..ffff0b5 100644 --- a/configuration/automations/bathroom-shower-motion.yaml +++ b/configuration/automations/bathroom-shower-motion.yaml @@ -7,27 +7,7 @@ from: 'off' to: 'on' action: - - choose: - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'on' - sequence: - - service: light.turn_on - entity_id: light.shower_lights - data: - brightness_pct: 100 - kelvin: 2000 - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'off' - sequence: - - service: light.turn_on - entity_id: light.shower_lights - data: - brightness_pct: 100 - kelvin: 3200 + - service: script.bathroom_shower_lights_on - id: bathroom-shower-motion-off alias: '[Bathroom] Shower Motion Off' @@ -49,5 +29,4 @@ for: '0:02:00' state: 'off' action: - - service: light.turn_off - entity_id: light.shower_lights \ No newline at end of file + - service: script.bathroom_shower_lights_off \ No newline at end of file diff --git a/scripts/92.lights-bathroom.yaml b/scripts/92.lights-bathroom.yaml new file mode 100644 index 0000000..ef5685f --- /dev/null +++ b/scripts/92.lights-bathroom.yaml @@ -0,0 +1,179 @@ +bathroom_lights_toggle: + alias: '[Bathroom] Lights toggle' + sequence: + - choose: + - conditions: + - condition: state + entity_id: light.bathroom_lights + state: 'on' + sequence: + - service: script.bathroom_lights_off + - conditions: + - condition: state + entity_id: light.bathroom_lights + state: 'off' + sequence: + - service: script.bathroom_lights_on + +bathroom_lights_on: + alias: '[Bathroom] Lights on' + sequence: + - choose: + - conditions: + - condition: state + entity_id: input_select.home_mode + state: Day + sequence: + - choose: + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'on' + sequence: + - service: light.turn_on + entity_id: light.bathroom_lights + data: + brightness: 255 + - service: light.turn_on + entity_id: light.bathroom_lights + data: + kelvin: 2000 + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'off' + sequence: + - service: light.turn_on + entity_id: light.bathroom_lights + data: + kelvin: 3200 + - service: light.turn_on + entity_id: light.bathroom_lights + data: + brightness: 255 + - conditions: + - condition: state + entity_id: input_select.home_mode + state: Night + sequence: + - service: light.turn_on + entity_id: light.bathroom_color_zha_group_0x0007 + data: + brightness_pct: 5 + hs_color: + - 360 + - 100 + +bathroom_lights_off: + alias: '[Bathroom] Lights off' + sequence: + - service: light.turn_off + entity_id: light.bathroom_lights + - service: light.turn_off + entity_id: light.bathroom_mirror_lights + - service: light.turn_off + entity_id: light.shower_lights + - service: light.turn_off + entity_id: light.bathroom_color_zha_group_0x0007 + - service: media_player.media_pause + entity_id: media_player.bathroom_speaker + +bathroom_mirror_lights_toggle: + alias: '[Bathroom] Mirror lights toggle' + sequence: + - choose: + - conditions: + - condition: state + entity_id: light.bathroom_mirror_lights + state: 'on' + sequence: + - service: script.bathroom_mirror_lights_off + - conditions: + - condition: state + entity_id: light.bathroom_mirror_lights + state: 'off' + sequence: + - service: script.bathroom_mirror_lights_on + +bathroom_mirror_lights_on: + alias: '[Bathroom] Mirror lights on' + sequence: + - choose: + - conditions: + - condition: state + entity_id: input_select.home_mode + state: Day + sequence: + - choose: + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'on' + sequence: + - service: light.turn_on + entity_id: light.bathroom_mirror_lights + data: + kelvin: 2000 + - service: light.turn_on + entity_id: light.bathroom_mirror_lights + data: + brightness: 255 + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'off' + sequence: + - service: light.turn_on + entity_id: light.bathroom_mirror_lights + data: + kelvin: 3200 + - service: light.turn_on + entity_id: light.bathroom_mirror_lights + data: + brightness: 255 + - conditions: + - condition: state + entity_id: input_select.home_mode + state: Night + sequence: + - service: light.turn_on + entity_id: light.bathroom_mirror_lights + data: + brightness: 25 + +bathroom_mirror_lights_off: + alias: '[Bathroom] Mirror lights off' + sequence: + - service: light.turn_off + entity_id: light.bathroom_mirror_lights + +bathroom_shower_lights_on: + alias: '[Bathroom] Shower lights on' + sequence: + - choose: + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'on' + sequence: + - service: light.turn_on + entity_id: light.shower_lights + data: + brightness_pct: 100 + kelvin: 2000 + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'off' + sequence: + - service: light.turn_on + entity_id: light.shower_lights + data: + brightness_pct: 100 + kelvin: 3200 + +bathroom_shower_lights_off: + alias: '[Bathroom] Shower lights off' + sequence: + - service: light.turn_off + entity_id: light.shower_lights \ No newline at end of file