Struggling with get template node - template persisting from previous node

Hi all,

I’m trying to automate my heating. I have a number of climate entities where the current status (‘off’, ‘heating’) is contained in the following attribute

{{state_attr("climate.lounge", "hvac_action")}}

The full climate entity is as follows:

hvac_modes:
  - 'off'
  - heat
current_temperature: 16.7
min_temp: 4
max_temp: 28
temperature: 4
hvac_action: 'off'
preset_mode: null
preset_modes:
  - boost
status:
  type: radiator
  mode: timer
  temperature: 16.71500015258789
  override:
    duration: 1353
    setpoint: 18
friendly_name: Lounge
icon: 'mdi:radiator'
supported_features: 17

What I want to do is, once the heating is running, loop through each entity every few minutes and check what the current status is, so I can then carry out any downstream actions.

I’ve set up get template nodes to read the hvac_action and this works when injecting and reading the output…

However, when I string multiple entities together the template always remains the same, i.e. it keeps checking the same room rather than checking the template in each individual node. I’ve tried everything I can think of but I’m getting nowhere. Can anyone help please?

full config here…

[{"id":"437aedae.980cd4","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"e314632b.c7f6b","type":"looptimer","z":"437aedae.980cd4","duration":"1","units":"Minute","maxloops":"13","maxtimeout":"61","maxtimeoutunits":"Minute","name":"","x":800,"y":280,"wires":[["d9ce76f3.678278"],[]]},{"id":"d9ce76f3.678278","type":"api-render-template","z":"437aedae.980cd4","name":"lounge on?","server":"9133f0de.c8669","template":"{{state_attr(\"climate.lounge\", \"hvac_action\")}}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":1070,"y":260,"wires":[["6061b969.8732c8","40f96e1.f46149"]]},{"id":"9c0d4b4e.127a48","type":"api-render-template","z":"437aedae.980cd4","name":"kitchen on?","server":"9133f0de.c8669","template":"{{state_attr(\"climate.kitchen\", \"hvac_action\")}}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":1066.8571434020996,"y":327.6666421890259,"wires":[["6f08ea0f.0c2a44","bfea88c6.097098"]]},{"id":"9b1b03be.151e8","type":"api-render-template","z":"437aedae.980cd4","name":"hall on?","server":"9133f0de.c8669","template":"{{state_attr(\"climate.hall\", \"hvac_action\")}}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":1056.8571434020996,"y":387.6666421890259,"wires":[["1934e82d.a244d8","784ae1e4.f68be"]]},{"id":"a879a35f.37566","type":"api-render-template","z":"437aedae.980cd4","name":"bathroom on?","server":"9133f0de.c8669","template":"{{state_attr(\"climate.bathroom\", \"hvac_action\")}}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":1076.8571434020996,"y":447.6666421890259,"wires":[["87500fe3.511da","4f3c1dd0.289854"]]},{"id":"dc46e7de.6c7658","type":"api-render-template","z":"437aedae.980cd4","name":"playroom on?","server":"9133f0de.c8669","template":"{{state_attr(\"climate.playroom\", \"hvac_action\")}}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":1076.8571434020996,"y":507.6666421890259,"wires":[["ac549464.b424d8","f3030588.f8c108"]]},{"id":"854fef9.ceaba1","type":"change","z":"437aedae.980cd4","name":"send stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":789,"y":426,"wires":[["e314632b.c7f6b"]]},{"id":"6061b969.8732c8","type":"switch","z":"437aedae.980cd4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"heating","vt":"str"},{"t":"eq","v":"heating","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1290,"y":260,"wires":[["9c0d4b4e.127a48"],[]]},{"id":"6f08ea0f.0c2a44","type":"switch","z":"437aedae.980cd4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"heating","vt":"str"},{"t":"eq","v":"heating","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":1290,"y":320,"wires":[["9b1b03be.151e8"],[]]},{"id":"1934e82d.a244d8","type":"switch","z":"437aedae.980cd4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"heating","vt":"str"},{"t":"eq","v":"heating","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":1290,"y":380,"wires":[["a879a35f.37566"],[]]},{"id":"87500fe3.511da","type":"switch","z":"437aedae.980cd4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"heating","vt":"str"},{"t":"eq","v":"heating","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":1290,"y":440,"wires":[["dc46e7de.6c7658"],[]]},{"id":"ac549464.b424d8","type":"switch","z":"437aedae.980cd4","d":true,"name":"","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"heating","vt":"str"},{"t":"eq","v":"heating","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":1290,"y":520,"wires":[["854fef9.ceaba1"],[]]},{"id":"49cfcca8.8af464","type":"inject","z":"437aedae.980cd4","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":746.8571434020996,"y":187.66664218902588,"wires":[["d9ce76f3.678278"]]},{"id":"40f96e1.f46149","type":"debug","z":"437aedae.980cd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1430,"y":200,"wires":[]},{"id":"bfea88c6.097098","type":"debug","z":"437aedae.980cd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1430,"y":300,"wires":[]},{"id":"784ae1e4.f68be","type":"debug","z":"437aedae.980cd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1430,"y":360,"wires":[]},{"id":"4f3c1dd0.289854","type":"debug","z":"437aedae.980cd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1430,"y":420,"wires":[]},{"id":"f3030588.f8c108","type":"debug","z":"437aedae.980cd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1430,"y":480,"wires":[]},{"id":"9133f0de.c8669","type":"server","z":"","name":"Home Assistant"}]

Many thanks,

Matt

After days and days, I’ve resolved this. For anyone else who may happen to stumble across this, the issue was that I was setting msg.template (which was a default value) in an upstream node, and I hadn’t realised!

1 Like