Check if sensor value change to 0


How can i check if a current usage sensor changed to zero in an automation, the trigger is a changing kw sensor. I have a boiler with smart plug and a current usage sensor on the smart plug, when the current usage is approximately 2400w, the boiler is on. When the boiler reaches the set temperature , the boiler shuts itself off, but the smart plug is still on, so i want to detect when smart plug current usage changes from 2400w approximately to 0w, then i can turn off the smart plug.
Is this possible?

Of course. Do you already have the smart plug sensor reading in HA? Probably the best way is to use a numeric state trigger, and detect when the plug reading goes below a certain value, perhaps 100W.

It’s good practice to check the value is stable by ensuring it’s stayed below threshold for a while, perhaps a minute or two, unless you need super-quick reactions. In the UI (but obviously select your sensor):

Yes i have the sensor in HA, it’s part of the smart plug.
Below the current power sensor:

The smart plug entities below:

I will try with the numeric state trigger.

I’ve a random question: how do you plan to power it back on?

I’m trying to find ways to optimize my energy consumption, and while turning appliances off with a smart plug is an option, I’d like to avoid the hassle of having to turn them back on when needed.

Yes i want to create an automation which looks at the energy production sensor of the smart meter. If the energy production increases with a certain amount of kwh energy, it should automatic turn the smart plug on. The energy production sensor updates every 30seconds.

But i have another topic at this case. I tried with trigger from state and trigger to state but that didn’t work, it triggers always the automation because the sensor could update and stays at the same value

Ok, your goal is not to turn on/off on usage but to do self consumption. Got it.

Yes maybe if this is working, i could implement something which turn off based on the energy production, but in that case i maybe should calculate something with pid controllers e.t. At this moment to complicated

By the way, the numeric state trigger works perfectly thanks a lot!

1 Like