diff --git a/configuration/automations/computer-button.yaml b/configuration/automations/computer-button.yaml index 1e0d2aa..82cfac6 100644 --- a/configuration/automations/computer-button.yaml +++ b/configuration/automations/computer-button.yaml @@ -1,5 +1,6 @@ -- id: button-office-on +- id: office-button-light-toggle alias: '[Office] Button Light' + mode: single trigger: - device_id: 5b972523e427721ec88e095994f7cc16 domain: zha @@ -7,43 +8,9 @@ type: remote_button_short_press subtype: turn_on action: - - choose: - - conditions: - - condition: state - entity_id: light.office - state: 'on' - sequence: - - service: light.turn_off - entity_id: light.office - - conditions: - - condition: state - entity_id: light.office - state: 'off' - sequence: - - choose: - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'on' - sequence: - - service: light.turn_on - entity_id: light.office - 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.office - data: - brightness_pct: 100 - kelvin: 3200 - mode: single + - service: script.office_lights_toggle -- id: button-office-off +- id: office-button-wol alias: '[Office] Button WoL' trigger: - device_id: 5b972523e427721ec88e095994f7cc16 diff --git a/scripts/95.lights-office.yaml b/scripts/95.lights-office.yaml new file mode 100644 index 0000000..285bc31 --- /dev/null +++ b/scripts/95.lights-office.yaml @@ -0,0 +1,47 @@ +office_lights_toggle: + alias: '[Office] Lights toggle' + sequence: + - choose: + - conditions: + - condition: state + entity_id: light.office + state: 'on' + sequence: + - service: script.office_lights_off + - conditions: + - condition: state + entity_id: light.office + state: 'off' + sequence: + - service: script.office_lights_on + +office_lights_off: + alias: '[Office] Lights off' + sequence: + - service: light.turn_off + entity_id: light.office + +office_lights_on: + alias: '[Office] Lights on' + sequence: + - choose: + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'on' + sequence: + - service: light.turn_on + entity_id: light.office + 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.office + data: + brightness_pct: 100 + kelvin: 3200