SOLVED: Can a events:state node trigger off a topic?

Right now, I have an inject node querying my heater every 1 minute and then a switch node to check if msg.data.attributes.hvac_action = heating

But is there anyway to incorporate the check of msg.data.attributes.hvac_action into an events:state node?

[{"id":"7e3e42cfea83b4b1","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"22dd37c2be0a4ac1","type":"switch","z":"7e3e42cfea83b4b1","name":"Heater running?","property":"data.attributes.hvac_action","propertyType":"msg","rules":[{"t":"eq","v":"heating","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":557,"y":261,"wires":[[],[]]},{"id":"3f9134d5c7987963","type":"inject","z":"7e3e42cfea83b4b1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":142,"y":261,"wires":[["16210c70e22dce06"]]},{"id":"16210c70e22dce06","type":"api-current-state","z":"7e3e42cfea83b4b1","name":"Thermostat status","server":"ab3e2c53.e3491","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"climate.my_ecobee","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":333,"y":261,"wires":[["22dd37c2be0a4ac1"]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

image

Why wouldn’t you just have an state node specifically listening just for the status of the Thermostat, and making sure you have the box “output on connect” ticked too. That way you don’t need to poll, every thermostat change, will trigger the flow.

[{"id":"4619d267b9ab5772","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"96fbd3448118113b","type":"server-state-changed","z":"4619d267b9ab5772","name":"","server":"49949cfc.3312d4","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"climate.lower_house","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":40,"wires":[["d3790c0324c63e1e"]]},{"id":"a3cdc826aaa96248","type":"debug","z":"4619d267b9ab5772","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":40,"wires":[]},{"id":"d3790c0324c63e1e","type":"switch","z":"4619d267b9ab5772","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"heat","vt":"str"},{"t":"eq","v":"idle","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":120,"wires":[["a3cdc826aaa96248"],["a3cdc826aaa96248"]]},{"id":"49949cfc.3312d4","type":"server","name":"Gaia","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":true,"heartbeatInterval":"60"}]

@mobile.andrew.jones

Because my climate entity does not change state when the heater actually turns on. This is how it looks when the heater is running or not running. It just tells me if I have it set to HEAT or COOL.

image

Heat is the state that the thermostat is set to, not it’s action. The havc_action tells you whether it is actually heating or not. By not ticking the box to prevent state updates if the current and previous state is the same, then it will trigger on ANY change, including all the attributes. Which means you can always check the hvac_action on every update you receive.

1 Like

Ahhh gotcha! I didnt know a change of any attribute would trigger it (assuming i uncheck that box).

Thanks!

1 Like

Yes uncheck those boxes. So only the “output on connect” box is ticked, and then it will trigger for pretty much everything.