"Reliably" detecting changes in HVAC_state from "idle" to "Heating"?

Hi all,

Sorry for the long post but this is perplexing me !

I have 6 Sonoff TRVs talking to ZHA and a separate ZigBee relay driving my combi boiler (with a few outboard failsafes built in for good measure)

I can see my TRVs calling for heat (turn orange on my dashboard) with high reliability:

I added a smart boiler relay activation “bulb” at the top of the dashboard whilst debugging.

I can manually activate the smart boiler relay by switching it on / off, with 100% reliability so I am sure its not an RF path issue (verified with a spectrum analyser)

But despite trying several methods for automating the “boiler on” action, it seems that:

  • HA intermittently detects when 2 or more TRVs call for heat, but not 1;

  • I can turn the relay off reliably when the last TRV changes hvac_state to ‘idle’;

So it has to be my “turn on the boiler” automation right ? well this is what it currently looks like:

all very simple - I understand from forum posts here (yes I did read up before posting) that each action under “WHEN” is treated as an “OR” condition not an “AND”

My WHEN condition is completely built from the visual editor:

and as you can see “Idle” and “Heating” are two natively supported states.
of my Sonoff TRVs

If I manually trigger the action, the boiler relay clicks in and everything starts to heat, but if I save it and leave it …well…I currently have 4 TRVs calling for heat and the boiler relay is off . I manually “kickstart” the boiler relay - the house gets up to temperature and the Boiler_OFF automation shuts it down when the last TRV transitions to “Idle”

So I tried a slightly more “generic” approach

The idea of this was if any climate entity sets its ‘hvac_action’ to ‘heating’
then the relay is turned on.

This never triggers at all ! I’ve compared the YAML of the first approach so I am fairly confident that I can rule out syntax of capital “I” or “H” or “HVAC” and the script passes YAML verification.

So is there some unknown to me Hysteresis factor in generic_thermostat ?

I dont believe there is as on the thermostat dashboard the state change gets detected 100% just that the first automation approach doesnt trigger the relay reliably , and the second approach doesnt trigger it at all.

Any suggestions as to a more reliable way to detect the hvac_action ot the TRV please ? as to my old eyes, this “should” be straightforward ?

Surely I dont need one boiler on automation per TRV ?

Many thanks in advance

Regards

The Perplexed

BB

Having written this out, I suspect the issue may be my logic - grateful if people can confirm this?

Either:

A change from idle to heating by ONE device triggers the automation ONE time

but until a further device triggers the automation, nothing will happen ?

SO do I need a watchdog timer on the automation condition like:

every 30 seconds…

Alternatively, I have something wrong in my ‘boiler off’ automation ? Which currently looks like

with the “it was the last TRV calling for heat” template being:

Hope that completes the picture

I feel sure I will kick myself when someone spots my mistake !

Regards

BB

Your template won’t work.
It has to be a namespace if you want to pick up a value from within a loop

Thanks @Hellis81

I have a couple of templates across my 2 posts - which particular one do you refer to please ?

regards

BB

The ending one in the previous post.
All_idle and a loop.

First, please follow Community Questions Guidelines #14 and #11 by posting your automation configuration as properly formatted YAML instead of screenshots. It makes it significantly easier for us to see what you are actually doing and to propose edits.

Second, check the attribute value in your template. This is a common point of confusion… the values you see in the frontend are often made “Friendlier”, but that isn’t the necessarily the real value that you use in templates or YAML configuration. In this case “Idle” is the friendly version, but the template likely needs “idle”. You can check the values in the States tool.

If you want to use a template for the CH_DEACTIVATE automation, you can just use a template Trigger that fires when all climate entities’ hvac_action attributes are “idle” as follows:

trigger: template
value_template: |
 {{ states.climate 
 | rejectattr('attributes.hvac_action','eq','idle') 
 | list | count == 0  }}

That would replace all the State triggers as well as the Template Condition.

thanks to all, with some pointers from AI I now have this working as intended…

I will later post the automations (on a work coffee break right now) , but the main “performance” difference was a setting that , as far as I can tell . can only be altered in the YAML so if youre an HA noob, build it in the GUI , then switch to the YAML view to edit:

mode = single
which became
mode = queued

regards

BB

Just in case anyone is waiting with baited breath for me to publish the fix, I do not intended to just abandon the thread with “Its fixed” (Dawkins! I hate that!) but life has got in the way for a few days. I have written into notepad the method for the boiler off script, still need to write the method for the boiler on , and grab a couple of screenshots.

Bear with me

it will probably be next week now

Regards

BB