diff --git a/configuration/automations/ac.yaml b/configuration/automations/ac.yaml index 5294310..78a5e59 100644 --- a/configuration/automations/ac.yaml +++ b/configuration/automations/ac.yaml @@ -25,27 +25,18 @@ entity_id: binary_sensor.office_window_open_close state: 'off' action: - - choose: - - conditions: - - condition: state - entity_id: climate.ac - state: cool - sequence: - - service: climate.set_temperature - target: + - service: script.ac_on + - choose: + - conditions: + - condition: state entity_id: climate.ac - data: - temperature: "{{ state_attr('climate.ac', 'temperature') -1 }} " - default: - - service: climate.turn_on - target: - entity_id: climate.ac - - service: climate.set_temperature - data: - temperature: 25 - hvac_mode: cool - target: - entity_id: climate.ac + state: cool + sequence: + - service: climate.set_temperature + target: + entity_id: climate.ac + data: + temperature: "{{ state_attr('climate.ac', 'temperature') -1 }} " - id: ac-turn-off alias: '[AC] Turn off when windows are open' @@ -67,6 +58,4 @@ for: minutes: 1 action: - - service: climate.turn_off - target: - entity_id: climate.ac + - service: script.ac_off diff --git a/configuration/automations/bedroom-ac.yaml b/configuration/automations/bedroom-ac.yaml index c2ddcf4..ce9cbb4 100644 --- a/configuration/automations/bedroom-ac.yaml +++ b/configuration/automations/bedroom-ac.yaml @@ -17,6 +17,7 @@ entity_id: input_select.home_mode state: Night action: + - service: script.ac_on - choose: - conditions: - condition: state @@ -28,16 +29,6 @@ entity_id: climate.ac data: temperature: "{{ state_attr('climate.ac', 'temperature') -1 }} " - default: - - service: climate.turn_on - target: - entity_id: climate.ac - - service: climate.set_temperature - data: - temperature: 24 - hvac_mode: cool - target: - entity_id: climate.ac - id: bedroom-ac-turn-off alias: '[AC][Bedroom] Turn off AC when it is cold in bedroom' @@ -64,9 +55,7 @@ attribute: temperature state: '25' sequence: - - service: climate.turn_off - target: - entity_id: climate.ac + - service: script.ac_off default: - service: climate.set_temperature target: diff --git a/configuration/automations/work.yaml b/configuration/automations/work.yaml index fab6f33..3a77d22 100644 --- a/configuration/automations/work.yaml +++ b/configuration/automations/work.yaml @@ -129,9 +129,7 @@ entity_id: sensor.ble_temperature_computer_cave_sensor above: "23" action: - - service: climate.turn_on - target: - entity_id: climate.ac + - service: script.ac_on - service: climate.set_temperature data: temperature: 25 diff --git a/scripts/80.ac.yaml b/scripts/80.ac.yaml new file mode 100644 index 0000000..77c4fc7 --- /dev/null +++ b/scripts/80.ac.yaml @@ -0,0 +1,37 @@ +ac_off: + alias: AC turn off + sequence: + - service: climate.turn_off + target: + entity_id: climate.ac + - delay: '0:05:00' + - choose: + - conditions: + - condition: state + entity_id: climate.ac + state: 'off' + sequence: + - service: switch.turn_off + entity_id: switch.ac_power_outlet + +ac_on: + alias: AC turn on + sequence: + - choose: + - conditions: + - condition: state + entity_id: switch.ac_power_outlet + state: 'off' + sequence: + - service: switch.turn_on + entity_id: switch.ac_power_outlet + - repeat: + until: + - condition: state + entity_id: climate.ac + state: unavailable + sequence: + - delay: '0:00:30' + - service: climate.turn_on + target: + entity_id: climate.ac \ No newline at end of file