I have a simple automation defined in HA to mange my fresh air vent when climate.hvac calls for heating. Here’s the code for that:
alias: "Ventilate during HVAC operation "
description: "Turn on outside vent for 5m when heat or cooling is activated. "
trigger:
- platform: state
entity_id:
- climate.hvac
attribute: hvac_action
to: heating
for:
hours: 0
minutes: 1
seconds: 0
- platform: state
entity_id:
- climate.hvac
attribute: hvac_action
to: cooling
for:
hours: 0
minutes: 0
seconds: 5
condition:
- condition: numeric_state
entity_id: sensor.back_yard_temperature
above: 45
below: 100
action:
- service: switch.turn_on
data: {}
target:
entity_id:
- switch.relay_01_2
- delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id:
- switch.relay_01_2
mode: single
This works, but there are some other decision points I want to add and I want this combined with my other HVAC nodes in Node-RED. However, pulling out the attributes is proving challenging. After some research I figured out how to trigger based on a change in attributes, but it also keeps re-deploying with other unrelated attribute changes (humidity and temp sensor for example). Here’s the view for my node that is working at the moment, but re-deploying unnecessarily:
All I want this to trigger on is when data.new_state.attributes.hvac_action
is heating
. I don’t know how to filter out changes in the other attributes.