Is there a good way to trigger a counter when power usage exceeds a certain value?

Hi everyone!

I am wondering if there is a good way to trigger a counter when a smart plug reports a power usage higher than a certain value? I am using Aqara smart plugs, on zigbee.

What I hope to accomplish is to measure two sets of time from when my wood boiler is operating.

When it starts it’s mini-inferno, it activates a fan. When it has stopped burning and the fuel is reduced to ashes, it stops the fan.

What I would like to know is:

How long did it take to burn out the fuel? (ie how long was the fan operating).

How long has it been since the boiler last operated? (ie how long has it been since the fan stopped).

It is also important that the results are saved and can be looked at in the future, as I am trying to energy optimize my house. The longer time before having to start the boiler again, the more efficient heat retention.

A graphical counter on the UI would be really nice.

Anyone who can think of a solution? :slightly_smiling_face:

Does the wood boilder use the aqara plug or the fan? Or both? Which device reports the power usage?

Thank you for your reply!

I will try to elaborate:

The wood boiler is connected to an Aqara smart plug. The Aqara plug is connected to a “standard” (Schuko) wall outlet with 230V.

The fan is an internal component of the wood boiler, it starts when you press a button (which you do when you fill the boiler with wood and ignite it).

So the only “smart” component in this setup is the Aqara plug. But I figure that the fan will draw some amount of power when activated, and the Aqara plug should be able to detect it.

First i would do is to make a graph out of the power-sensor from your Aqara-plug ( Grafana make detailed cool graphs and with InFluxDB you will have this as long-term statistics, thou you might wanna use apex-graph-card( then your entirely depended on the homeassistant_db “Purge-Period”.
Secondly either add a thress-hold to the the graph-card, as an Attributes, or you are maybe able to use the Threshold-integration, to read direct from your power-sensor.

Or better of a Template-Sensor to read the power-sensor (i.e When power-usage goes from 0 to >0 start heating-period, when power-usage goes from >0 to 0 stop-period … not sure this exact example will work, but there is help here, for exact “definition/syntax”

  • After monitoring the graph and your heating system. i.e before you light the fire, and after starting the Fan, you will see whats happening with the power-usage, and from that decide when/what level to set the lower-power-usage-threshold ( could be zero Wat, or 0.07 Wat(on the external-plug), before fan starts, and then immediately when it starts i.e 8 Wat ( this is where your time period “Fan” starts) ( when power goes from zero(something) to +(above something)

  • When the Fan stops( you can also see that on the power-graph ) , but it might use less and less Wat before it stops / as it also use more and more Wat, when the heat goes up.

As im not sure how accurate the plug is, or if it +boilers internal electricity use just a little, even before you turn on the switch on your boiler, you have to figure this out, as well as exactly how your Fan acts during heating period ( i.e does it stop periodically )
Normally i would have stopped the Fan, most likely before the “ashes state” as you mention

The “normal” drag would be enough for the last “glowing almost ashes” to burn out … im not familiar with your wood-boiler, chimney etc , neither the exact function of the internal fan. … however you will notice on the power-graph, that the fan will use less and less power ( unless it’s some old home hack, that runs full power from start to stop, which i doubt ) :slight_smile: … so know your “Devices” is AO , to figure out best/cheapest/effective solution

Lets say, over a week, you see on the power-graph , that the Fan uses to go down to a certain level i.e 4 Wat, or slowly goes further and further down, to eventually zero, or zero+ etc. “sleepmode-power-usage” :slight_smile: , you decide a "braking-point " where your Fan stops ( when power goes from +something to zero-something)

You can direct read this from the graph, and obviously above is not an optimal solution, but quit accurate, best would be if you attach a “sensor/switch” direct to the Boilers Fan-switch ( i would/have ), unless ur absolutely sure it dont use any power, when the Fan is turned of, and that the Fan don’t periodically stops during “heating-period” , this you will also notice in your graph)

PS: if it’s just for “monitoring purpose” i.e not planning any advance automatons attached, triggered from the Graph, i would go for Grafana+InfluxDB , and an automation could easily be triggered from the power-sensor with template, even a template-counter
But start with a graph, and monitor your system, get to know the boiler/fan/power-usage pattern, you’ll get more insight and ideas within a month …And then search this forum for i.e “heating automation”

Thank you very much for this insightful reply! I am sincerely grateful. :slightly_smiling_face:

I Will have to take it bit by bit (the automation as well as your post :wink:)

Thanks for the tip, I agree that I must get to know the fan/boiler/power consumption first thing.

I do have Grafana and Influx installed, and I have managed to collect data from temperature/moisture sensors, so I just might be able to log data also from the smart plug.

Thanks again, I will post further, when I have some data from the fan (ie smart plug)

yes, you’ll find the power-plug in Grafana, use basically the same “construction” as for temperature
You will soon see the pattern the Fan uses, based upon how you “fire-up”, whether you fill it to much, or it’s to humid wood you use, how much air(from Fan) the fire gets/needs, best would be if you could monitor the temperature on the “outlet” to chimney , so you know if it gets the right proportion of air, and an optimal burning temperature, thou again, i dont know how modern your Boiler and Fan is

Thou an easy way to get a graph is i.e
ADD new Card( in a dashboard/View), scroll to the button, and start with Manual-Card, and copy/paste below code, and change to your power-sensor-name, you will find the name of the sensor, under /Configuration/Integration/Entities (or in your integration for you plug)

type: history-graph
entities:
  - entity: sensor.your_power_sensor
hours_to_show: 48
refresh_interval: 3

or increase the hours to 72