Transition from Tuya / Smart Life -> ZigBee Plugs: ONLY Goal: live usage & kWh Reporting

I bought ZigBee Eightree ET52 Smart Plugs & RaspBee2 Pi serial addon.

I ASSUMED that, since ZigBee seemed to be an advanced infrastructure, that my previous (painless) kWh reporting in Smart Home, would be EASY in the ZigBee world.

I HAVE managed to install & run RaspBee2 & deCONZ / Phoscon & openHAB. (all in Portainer/Docker. openHAB on a diff machine).

The first trial plug in showing in Phoscon.
I’ve registered openHAB with deCONZ. Have the deCONZ bridge & Phoscon “group” showing in openHAB.

HOWEVER… my question here is nothing to do with my setup.

According to my Brave AI search, my current ZigBee Plugs support “live elec usage”, but NOT cumulative kWh stats.

Is this a limitation with many ZigBee Plugs, or many plugs in general? Does Smart Home itself build the kWh database?

If I need to buy BETTER ZigBee plugs, which support cumulative kWh stats, what would be considered GOOD ZigBee Smart Plug hardware here?

The other consideration is…. I can code, so if my ZigBee (Eightree ET52) plugs consumption reporting can be captured, it’s possible I can build a database to build my own kWh stats….

Alternatively …..is there already an openHAB plugin which will build a kWh database, if not directly supported on the Plugs?

I would look at the devices manuals before I’d trust an AI for something like this. It’s likely true but Leo may be just making it up.

From my experience, it’s not uncommon for plugs like these to only report instantaneous usage. Most of my plugs don’t even report that.

You can create rules to calculate the kWh based on the instantaneous usage. It will only be close though, not exact. The big challenge will be calculating the time between each reading to come up with the “hours”. But that isn’t even all that hard.

In a JS rule that would look something like the following. I assume the rule triggers on updates to the power usage Item, the Item is of type Number:Power, and the cumulative energy Item is of type Number:Energy.

const delta = time.Duration.betweenTimes(items.PowerItem.lastUpdateTimestamp, time.toZDT()); // time between readings
const energy = items.PowerItem.quantityState.multiply(Quantity(delta+ ' s')); // convert to energy (i.e. Ws)
items.EnergyItem.postUpdate(items.EnergyItem.quantityState.add(energy)); // Add cumulative power to running total

The UoM of the Items will do all the conversions necessary. If the EnergyItem’s unit is kWh, the Ws added to is above will be converted to kWh automatically. If the plug reports VA or dBm instead of W that conversion will also be handled for you.

Initializing and resetting the EnergyItem and other details are an exercise left to the student.

No database is required with this approach. The cumulative Energy total is calculated on each reading and it should work whether the readings are regular or not. Note I just typed in the above. There are almost certainly typos.

You’re doing LOTS of typing there!!

Yeah, I don’t 100% trust my Brave AI, but it gives me clarity on more general questions.

I have found it contradicting itself, so I ask a question is 2 different ways, etc.

I searched for ZigBee plugs supporting Energy Montoring. A name which came up was the NUOS A1Z. Its clearly advertised as supporting an Energy readout, I think including kWh. I’ll see how I get on with it.

IMO, Energy monitoring should be a BASIC feature, or maybe bc of the data storage, its an ADVANCED feature? This NOUS certainly cost a little more.

Most people who just want to turn on or off a lamp with a smart plug they don’t care about the power usage. Often where there is a demand are the heftier smart plugs that are attached to appliances and other heavy power users.

There are home energy meters they clamp on to the wires at the central circuit box for those who want to monitor the whole home’s energy use.

None of my smart outlets nor smart plugs nor smart wall switches report power nor energy.