Running home assistant on VM (esxi) for over a year now:
Version - core-2021.7.3
Supervisor - supervisor-2021.06.8
Installation Type - Home Assistant OS
I have an issue with a very simple automation.
My goal:
to start a pool heater when the electrical power i put back on the net goes above a certain treshold
to stop the pool heater when the electrical powder i put back on the net goes below a certain treshold
for this i have made two automations via the GUI (on for the on part and one for the off part):
The on automation behaves perfectly, the off automation does not. If i manually run the automation, the action gets done (setting of the heater), so this part at least works.
the sensor_elec_terug_watts is just basic sensor, changing the input i get from my utility meter from Kw to Watt:
Have you read about how numeric_state trigger works? Fires when the numeric value of an entityâs state (or attributeâs value if using the attribute property) crosses a given threshold.
You can also read about numeric_state trigger here - a blog post made by Tinkerer.
So, the off automation only triggered if the value of sensor.elec_terug_watts start above your threshold and then go under your threshold.
Note: When you manually run the automation, it skips directly to the action part of your automation.
If you want HA to set the heater on/off when you just missed the moment the threshold was passed (for example a HA restart) you can add HA restart as a trigger. If you then also add everything to a single automation you end up with
Thanks for your reply. I have in fact read up on the numeric_state and thought it was quite self-explanatory. Sure i grasp the concept of the tresholds, however i have tried these automations numerous days (i.e. the tresholds were met multiple times) and only the on automation fired away.
Perhaps let me explain what I see in home assistant during the day.
the sun starts shining in the morning, and after a while the âsensor.elec_terug_wattsâ starts climbing from 0 up to ~8700 at the peak of the day.
when it has passed 3100 for at least 5 minutes (the sensor gets an update each second) the automation for on starts (as it should be)
in the afternoon-night (or when multiple heavy consumers in my house are running) this âsensor.elec_terug_wattsâ will return to 0.
when it has passed back the treshold (i.e. below 100), the off automation does not fire.
As I donât have any conditions in my off automation, is there anything I am missing? Does the situation described above, not meet everything for the automation to fire?
The first thing to do is troubleshooting as ardysusilo mentioned above.
My guess would be, that sensor.electriciteitterug isnât updated regularly. Can you check the history of that sensor? Is it really working the way it should (eg. passing the 100 treshold)?
You can try changing the value of sensor.elec_terug_watts in-
Developer Tools â States (tab) â Type sensor.elec_terug_watts in the entity â Put a random number under 100, for example 50 in the state â Set State
After that, please check again at your off automation debug.
Also, make sure to check the toggle button for your off automation. Sometimes we forget that we turn off the automation.
if thatâs true, wouldnât the same issue occur with the on automation? The logic behind the two automation-triggers (i.e. above xxxx and below xxxx) is the same, no?
the sensor should update more or less each second, this works via a digital read-out directly from my utility meter (there is a conversion step from KW to Watt, as listed above), i dont know the implications of that on the refresh rate, however i see the values changing on my home dashboard quite rapidly (also more or less each scond).
This is just a guess, really, so donât take it as a solution right away!
Two things come to mind:
to much stress on HA and itâs automations. Meaning the template sensor to change from W to kW isnât fast enough to keep up. Just for the sake of trying, can you leave that one out and change the automation to work with W?
The sensor is updated to frequently, especially with some spikes, so the âturn_offâ getâs changed to âturn_onâ again within a split second.
yes the automation was made in the UI, and is visible in the UI.
yup, it dropped below 100 half an hour, when my heatpump started drawing power at 1PM for hot water (it eats a lot of power).
And yup, i have ~12.5 KW worth of solar panels on my roof, with a 8.7 KW converter on that. This was cmbined with a ~15KW heat pump (drawing peak power of around 5KW). And after ejoying this system for 1 year, on of the Belgian governments (Flemish) destroyed the previous agreement of basically using the power grid as a battery (your yearly solar production is set 1:1 with your yearly production). Hence i am looking now at battery systems and more complex automations (this one is just the start) to optimize my energy.
I just tried this and for the first time ever, the automation fired, hence the automation should work.
hmm, do you know the ârefresh rateâ at which home assistant checks the trigger conditions? perhaps this is too low/high in comparison with the refresh rate of the sensor?
Indeed a lot of calculations, but it seems to me HA is quite responsive to this (VM has two old Xeon-cores working for him - Xeon 2680v2) + decicated SSD + 4GB of RM.
If it were true on the sensor update frequency, would the log of the automation not register this?
Indeed a mystery. When en entity updates all automations that have that entity as a trigger are checked, there is no polling.
Is it possible to enable a high load? That way, if you remake the automation with a bit higher below threshold you can actually try the automation right away (instead of waiting for the sun to drop / water heater to heat.
I donât know how to explain this, but suddenly the automation off seems to be working. As there was just a dip in solar power, the off automation fired⌠really flabbergasted now this is suddenly working⌠anyway, hopefully it stays this way⌠thanks for all the help and suggestions, i have again learned some new stuff while troubleshooting this!
Nonetheless, something seems off. 300 seconds to run this automation? The state change is from 309 to 34âŚseems a little âlateâ to the under-100-party, doesnât it? Iâd monitor this sensor over the next days and would watch out for state changes and how everything reacts. As I said, I get a feeling, something is not 100% right.