From d267e79a5ac9995493a1fc96c379e96a34d936f8 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sun, 5 Mar 2023 20:47:12 -0500 Subject: [PATCH] Improved master bedroom fan scheduling I've decided I like the fan at cooler temperatures than I thought I would, so timing needed adjusted so it doesn't come on TOO early on the slightly chillier nights. --- packages/scheduling.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/scheduling.yaml b/packages/scheduling.yaml index cae63d5..a450fd5 100644 --- a/packages/scheduling.yaml +++ b/packages/scheduling.yaml @@ -405,11 +405,16 @@ script: entity_id: input_datetime.master_bedroom_fan data: time: > - {% set low = state_attr('sensor.current_forecast','overnight_low') | float %} - {% if low > 60 %} + {% set low = states('sensor.tonights_low_temp') | int %} + {% set high = states('sensor.todays_high_temp') | int %} + {% if low > 60 or is_state('input_boolean.hot_day','on') %} 22:30 - {% else %} + {% elif low <= 60 and low >= 50 %} + 23:30 + {% elif low >= states('input_number.master_bedroom_fan_threshold') | int and high > 50 %} 00:00 + {% else %} + 06:00 {% endif %} - service: input_select.select_option target: