Add cold day handling

This commit is contained in:
2023-01-16 16:58:41 -05:00
parent 7e95b1695b
commit 00204bdfd3
3 changed files with 41 additions and 3 deletions

View File

@ -76,6 +76,9 @@ input_boolean:
hot_day: hot_day:
name: Hot Day name: Hot Day
icon: mdi:heat-wave icon: mdi:heat-wave
cold_day:
name: Cold Day
icon: mdi:snowflake
input_select: input_select:
scheduled_climate_mode_master_bedroom_aircon: scheduled_climate_mode_master_bedroom_aircon:
@ -176,6 +179,12 @@ input_number:
max: 90 max: 90
step: 1 step: 1
unit_of_measurement: °F unit_of_measurement: °F
cold_day_threshold:
name: Cold Day Threshold
min: 0
max: 40
step: 1
unit_of_measurement: °F
automation: automation:
- id: '1655415573165' - id: '1655415573165'

View File

@ -16,18 +16,31 @@ template:
- binary_sensor: - binary_sensor:
- name: Heat Threshold - name: Heat Threshold
state: > state: >
{% set high = states('sensor.pirateweather_temperature') | int %} {% set temp = states('sensor.pirateweather_temperature') | int %}
{% set threshold = states('input_number.hot_day_threshold') | int %} {% set threshold = states('input_number.hot_day_threshold') | int %}
{% if high >= threshold %} {% if temp >= threshold %}
true true
{% else %} {% else %}
false false
{% endif %} {% endif %}
delay_off: '00:30:00'
device_class: heat device_class: heat
attributes: attributes:
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}" current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
threshold: "{{ states('input_number.hot_day_threshold') | 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: sensor:
- platform: weatheralerts - platform: weatheralerts

View File

@ -327,6 +327,22 @@ script:
- service: input_boolean.turn_off - service: input_boolean.turn_off
target: target:
entity_id: input_boolean.hot_day 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: house_scheduling_evening:
sequence: sequence: