From 1934ee783bc11bb86120e651c943f2b7f3c47497 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 10 Apr 2023 20:33:17 -0400 Subject: [PATCH] Attempt to only turn off E's A/C when the compressor is not running --- packages/emmalynn.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/emmalynn.yaml b/packages/emmalynn.yaml index 61ffa81..d467778 100644 --- a/packages/emmalynn.yaml +++ b/packages/emmalynn.yaml @@ -274,8 +274,23 @@ script: - condition: template value_template: >- {% set ct = ((now().hour * 60 + now().minute) * 60 ) %} - {{ is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') }} + {{ is_state('fan.emma_air_conditioner','on') and is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') }} then: - - service: fan.turn_off + - service: script.turn_on target: - entity_id: fan.emma_air_conditioner + entity_id: script.emma_aircon_shutoff + + emma_aircon_shutoff: + alias: 'Emma Air Conditioner Shutoff' + mode: restart + description: 'Attempt to shut off air conditioner after compressor stops running' + sequence: + - wait_template: "{{ is_state('binary_sensor.emma_aircon_compressor','off') }}" + timeout: + minutes: 10 + continue_on_timeout: true + - delay: + seconds: 5 + - service: fan.turn_off + target: + entity_id: fan.emma_air_conditioner