feat: Start implementing HVAC controls (migrate pause/restore to script)
This commit is contained in:
@@ -6,10 +6,8 @@ input_select:
|
|||||||
climate_mode:
|
climate_mode:
|
||||||
name: Climate Control Mode
|
name: Climate Control Mode
|
||||||
options:
|
options:
|
||||||
- Home
|
|
||||||
- Night
|
|
||||||
- Away
|
|
||||||
- 'Off'
|
- 'Off'
|
||||||
|
- Auto
|
||||||
- Manual
|
- Manual
|
||||||
- Paused
|
- Paused
|
||||||
|
|
||||||
@@ -63,12 +61,68 @@ input_datetime:
|
|||||||
has_date: false
|
has_date: false
|
||||||
has_time: true
|
has_time: true
|
||||||
|
|
||||||
|
input_text:
|
||||||
|
hvac_last_mode:
|
||||||
|
|
||||||
template:
|
template:
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- name: HVAC Fan Running
|
- name: HVAC Fan Running
|
||||||
state: >
|
state: >
|
||||||
{{ 'Running' in state_attr('climate.thermostat', 'fan_state') }}
|
{{ 'Running' in state_attr('climate.thermostat', 'fan_state') }}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Climate Scripts
|
||||||
|
script:
|
||||||
|
hvac_pause:
|
||||||
|
alias: Pause HVAC
|
||||||
|
mode: restart
|
||||||
|
sequence:
|
||||||
|
# Save the current thermostat mode because it may not be captured properly
|
||||||
|
# by `scene.create` (see https://github.com/home-assistant/core/issues/69925)
|
||||||
|
- action: input_text.set_value
|
||||||
|
target:
|
||||||
|
entity_id: input_text.hvac_last_mode
|
||||||
|
data:
|
||||||
|
value: "{{ states('climate.thermostat') }}"
|
||||||
|
|
||||||
|
# Snapshot the current mode and thermostat status
|
||||||
|
- action: scene.create
|
||||||
|
data:
|
||||||
|
scene_id: hvac_restore_state
|
||||||
|
snapshot_entities:
|
||||||
|
- climate.thermostat
|
||||||
|
- input_select.climate_mode
|
||||||
|
- input_text.hvac_last_mode
|
||||||
|
|
||||||
|
# Turn off the thermostat and set the mode to Paused
|
||||||
|
- action: climate.set_hvac_mode
|
||||||
|
target:
|
||||||
|
entity_id: climate.thermostat
|
||||||
|
data:
|
||||||
|
hvac_mode: "off"
|
||||||
|
|
||||||
|
- service: input_select.select_option
|
||||||
|
target:
|
||||||
|
entity_id: input_select.climate_mode
|
||||||
|
data:
|
||||||
|
option: Paused
|
||||||
|
|
||||||
|
hvac_restore:
|
||||||
|
alias: Resume HVAC
|
||||||
|
mode: restart
|
||||||
|
sequence:
|
||||||
|
# Restore the snapshot
|
||||||
|
- action: scene.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: scene.hvac_restore_state
|
||||||
|
|
||||||
|
# Restore the thermostat mode
|
||||||
|
- action: climate.set_hvac_mode
|
||||||
|
target:
|
||||||
|
entity_id: climate.thermostat
|
||||||
|
data:
|
||||||
|
hvac_mode: "{{ states('input_text.hvac_last_mode') }}"
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Climate Automations
|
# Climate Automations
|
||||||
automation:
|
automation:
|
||||||
@@ -92,26 +146,27 @@ automation:
|
|||||||
- "{{ not is_state('input_select.climate_mode', 'Paused') }}"
|
- "{{ not is_state('input_select.climate_mode', 'Paused') }}"
|
||||||
- "{{ is_state('input_boolean.guest_mode', 'off') }}"
|
- "{{ is_state('input_boolean.guest_mode', 'off') }}"
|
||||||
action:
|
action:
|
||||||
- service: scene.create
|
# - service: scene.create
|
||||||
|
# data:
|
||||||
|
# scene_id: hvac_restore_state
|
||||||
|
# snapshot_entities:
|
||||||
|
# # See https://github.com/home-assistant/core/issues/69925
|
||||||
|
# # - climate.thermostat
|
||||||
|
# - input_select.climate_mode
|
||||||
|
# - service: climate.set_hvac_mode
|
||||||
|
# target:
|
||||||
|
# entity_id: climate.thermostat
|
||||||
|
# data:
|
||||||
|
# hvac_mode: "off"
|
||||||
|
# - service: input_select.select_option
|
||||||
|
# target:
|
||||||
|
# entity_id: input_select.climate_mode
|
||||||
|
# data:
|
||||||
|
# option: Paused
|
||||||
|
- action: script.hvac_pause
|
||||||
|
- action: notify.status
|
||||||
data:
|
data:
|
||||||
scene_id: hvac_restore_state
|
message: "HVAC Paused ({{ states('sensor.open_windows_doors') }} open)"
|
||||||
snapshot_entities:
|
|
||||||
# See https://github.com/home-assistant/core/issues/69925
|
|
||||||
# - climate.thermostat
|
|
||||||
- input_select.climate_mode
|
|
||||||
- service: climate.set_hvac_mode
|
|
||||||
target:
|
|
||||||
entity_id: climate.thermostat
|
|
||||||
data:
|
|
||||||
hvac_mode: "off"
|
|
||||||
- service: input_select.select_option
|
|
||||||
target:
|
|
||||||
entity_id: input_select.climate_mode
|
|
||||||
data:
|
|
||||||
option: Paused
|
|
||||||
- service: notify.general
|
|
||||||
data:
|
|
||||||
message: HVAC Paused (Window or Door Open)
|
|
||||||
|
|
||||||
- alias: Restore HVAC when Doors/Windows Closed
|
- alias: Restore HVAC when Doors/Windows Closed
|
||||||
mode: queued
|
mode: queued
|
||||||
@@ -129,22 +184,24 @@ automation:
|
|||||||
for:
|
for:
|
||||||
minutes: 5
|
minutes: 5
|
||||||
condition:
|
condition:
|
||||||
- "{{ not is_state('input_select.climate_mode', 'Manual') }}"
|
|
||||||
- "{{ is_state('input_select.climate_mode', 'Paused') }}"
|
- "{{ is_state('input_select.climate_mode', 'Paused') }}"
|
||||||
|
- "{{ is_state('binary_sensor.all_doors', 'off') }}"
|
||||||
|
- "{{ is_state('binary_sensor.all_windows', 'off') }}"
|
||||||
action:
|
action:
|
||||||
- service: scene.turn_on
|
# - service: scene.turn_on
|
||||||
target:
|
# target:
|
||||||
entity_id: scene.hvac_restore_state
|
# entity_id: scene.hvac_restore_state
|
||||||
# See https://github.com/home-assistant/core/issues/69925
|
# # See https://github.com/home-assistant/core/issues/69925
|
||||||
# Assume thermostat is always heat_cool when not off
|
# # Assume thermostat is always heat_cool when not off
|
||||||
- service: climate.set_hvac_mode
|
# - service: climate.set_hvac_mode
|
||||||
target:
|
# target:
|
||||||
entity_id: climate.thermostat
|
# entity_id: climate.thermostat
|
||||||
|
# data:
|
||||||
|
# hvac_mode: "{{ 'off' if is_state('input_select.climate_mode', 'Off') else 'heat_cool' }}"
|
||||||
|
- action: script.hvac_restore
|
||||||
|
- action: notify.status
|
||||||
data:
|
data:
|
||||||
hvac_mode: "{{ 'off' if is_state('input_select.climate_mode', 'Off') else 'heat_cool' }}"
|
message: HVAC Restored (Windows and Doors closed)
|
||||||
- service: notify.general
|
|
||||||
data:
|
|
||||||
message: HVAC Restored (Window or Door Open)
|
|
||||||
|
|
||||||
- alias: Widen HVAC Range at Night
|
- alias: Widen HVAC Range at Night
|
||||||
mode: queued
|
mode: queued
|
||||||
|
|||||||
@@ -32,6 +32,20 @@ notify:
|
|||||||
services:
|
services:
|
||||||
- action: iphone_jp
|
- action: iphone_jp
|
||||||
|
|
||||||
|
# `notify.status` used for simple status reporting (e.g. washer done)
|
||||||
|
# Keeps these notifications separated from security alerts
|
||||||
|
- name: status
|
||||||
|
platform: group
|
||||||
|
services:
|
||||||
|
- action: iphone_jp
|
||||||
|
data:
|
||||||
|
data:
|
||||||
|
group: 'status-notification-group'
|
||||||
|
- action: iphone_jen
|
||||||
|
data:
|
||||||
|
data:
|
||||||
|
group: 'status-notification-group'
|
||||||
|
|
||||||
- name: everyone
|
- name: everyone
|
||||||
platform: group
|
platform: group
|
||||||
services:
|
services:
|
||||||
|
|||||||
Reference in New Issue
Block a user