From 1269579f82783574079eb15767b869307633b335 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Mon, 26 Sep 2022 21:33:44 +0200 Subject: [PATCH] Change brightness and move blinds to scripts --- configuration/automations/brightness.yaml | 10 +++--- configuration/automations/office-blinds.yaml | 32 ++--------------- scripts/110.office-blinds.yaml | 37 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 scripts/110.office-blinds.yaml diff --git a/configuration/automations/brightness.yaml b/configuration/automations/brightness.yaml index cdff431..89e8b17 100644 --- a/configuration/automations/brightness.yaml +++ b/configuration/automations/brightness.yaml @@ -22,10 +22,10 @@ trigger: - platform: numeric_state entity_id: sensor.office_illuminance - below: '140' + below: '160' for: hours: 0 - minutes: 1 + minutes: 2 seconds: 0 condition: - condition: or @@ -72,8 +72,8 @@ - service: cover.open_cover target: entity_id: - - cover.office_blinds - cover.dining_blinds + - service: script.office_blinds_up - id: brightness-bright alias: '[Brightness] Bright - close covers' @@ -81,7 +81,7 @@ trigger: - platform: numeric_state entity_id: sensor.office_illuminance - above: '1200' + above: '1300' for: hours: 0 minutes: 1 @@ -90,5 +90,5 @@ - service: cover.close_cover target: entity_id: - - cover.office_blinds - cover.dining_blinds + - service: script.office_blinds_down diff --git a/configuration/automations/office-blinds.yaml b/configuration/automations/office-blinds.yaml index bc7f37d..d5893ac 100644 --- a/configuration/automations/office-blinds.yaml +++ b/configuration/automations/office-blinds.yaml @@ -7,21 +7,7 @@ type: remote_button_short_press subtype: turn_on action: - - choose: - - conditions: - - condition: numeric_state - entity_id: cover.office_blinds - attribute: current_position - below: 51 - sequence: - - service: cover.close_cover - entity_id: cover.office_blinds - default: - - service: cover.set_cover_position - data: - position: 50 - target: - entity_id: cover.office_blinds + - service: script.office_blinds_down mode: single - id: office-blinds-button-up @@ -33,21 +19,7 @@ type: remote_button_short_press subtype: turn_off action: - - choose: - - conditions: - - condition: numeric_state - entity_id: cover.office_blinds - attribute: current_position - above: 49 - sequence: - - service: cover.open_cover - entity_id: cover.office_blinds - default: - - service: cover.set_cover_position - data: - position: 50 - target: - entity_id: cover.office_blinds + - service: script.office_blinds_up mode: single - id: office-blinds-button-down-all diff --git a/scripts/110.office-blinds.yaml b/scripts/110.office-blinds.yaml new file mode 100644 index 0000000..e3ef8a8 --- /dev/null +++ b/scripts/110.office-blinds.yaml @@ -0,0 +1,37 @@ +office_blinds_up: + alias: '[Office] Blinds up' + sequence: + - choose: + - conditions: + - condition: numeric_state + entity_id: cover.office_blinds + attribute: current_position + above: 49 + sequence: + - service: cover.open_cover + entity_id: cover.office_blinds + default: + - service: cover.set_cover_position + data: + position: 50 + target: + entity_id: cover.office_blinds + +office_blinds_down: + alias: '[Office] Blinds down' + sequence: + - choose: + - conditions: + - condition: numeric_state + entity_id: cover.office_blinds + attribute: current_position + below: 51 + sequence: + - service: cover.close_cover + entity_id: cover.office_blinds + default: + - service: cover.set_cover_position + data: + position: 50 + target: + entity_id: cover.office_blinds