diff --git a/packages/climate.yaml b/packages/climate.yaml index 4f03984..b193361 100644 --- a/packages/climate.yaml +++ b/packages/climate.yaml @@ -76,6 +76,9 @@ input_boolean: hot_day: name: Hot Day icon: mdi:heat-wave + cold_day: + name: Cold Day + icon: mdi:snowflake input_select: scheduled_climate_mode_master_bedroom_aircon: @@ -176,6 +179,12 @@ input_number: max: 90 step: 1 unit_of_measurement: °F + cold_day_threshold: + name: Cold Day Threshold + min: 0 + max: 40 + step: 1 + unit_of_measurement: °F automation: - id: '1655415573165' diff --git a/packages/custom_weather.yaml b/packages/custom_weather.yaml index 70bbacf..384c352 100644 --- a/packages/custom_weather.yaml +++ b/packages/custom_weather.yaml @@ -16,18 +16,31 @@ template: - binary_sensor: - name: Heat Threshold state: > - {% set high = states('sensor.pirateweather_temperature') | int %} + {% set temp = states('sensor.pirateweather_temperature') | int %} {% set threshold = states('input_number.hot_day_threshold') | int %} - {% if high >= threshold %} + {% if temp >= threshold %} true {% else %} false {% endif %} - delay_off: '00:30:00' device_class: heat attributes: current_temp: "{{ states('sensor.pirateweather_temperature') | int }}" threshold: "{{ states('input_number.hot_day_threshold') | int }}" + - binary_sensor: + - name: Cold Threshold + state: > + {% set temp = states('sensor.pirateweather_temperature') | int %} + {% set threshold = states('input_number.cold_day_threshold') | int %} + {% if temp <= threshold %} + true + {% else %} + false + {% endif %} + device_class: cold + attributes: + current_temp: "{{ states('sensor.pirateweather_temperature') | int }}" + threshold: "{{ states('input_number.cold_day_threshold') | int }}" sensor: - platform: weatheralerts diff --git a/packages/scheduling.yaml b/packages/scheduling.yaml index 86b88f0..e084d4e 100644 --- a/packages/scheduling.yaml +++ b/packages/scheduling.yaml @@ -327,6 +327,22 @@ script: - service: input_boolean.turn_off target: entity_id: input_boolean.hot_day + - if: + - condition: template + value_template: > + {% if state_attr('sensor.current_forecast','high_temp') >= states('input_number.cold_day_threshold') %} + true + {% else %} + false + {% endif %} + then: + - service: input_boolean.turn_on + target: + entity_id: input_boolean.cold_day + else: + - service: input_boolean.turn_off + target: + entity_id: input_boolean.cold_day house_scheduling_evening: sequence: