#Have Watts, need Watt-Hours

1 messages · Page 1 of 1 (latest)

limpid jolt
#

Hey all, how can I create a sensor that acts like the total_daily_energy sensor in ESPHOme? I've got some devices that will give me a reading of power. What I want is the usage of that device.

Here's what I've already tried:

  • Utility meter: works somehow, but outputs a value in Watt, not Watt-hours, which makes me suspicious. I guess it's not designed to work with power sensors but only to sum up existing usage sensors
  • Integral sensor: works and gives me a value in Wh, but has measurement class "total" instead of "total_increasing" with no way to change that, which causes problems downstream.
sweet night
#

did the template helper with total increasing work then?

limpid jolt
#

I should say I'm still on the sankey-chart thing. Neither of those sensors worked as intended. For the utility meter, it shows up, but with a wonky unit. The integral sensor gives me the error that it can't find the sensor, so I'm guessing it wants all sensors to match the state class of the root ones, because the power chart I built where everything has the state_class 'measurement' it works as expected.

#

I can show you the yaml if you want to see it.

sweet night
#

Like I said in the other thread, I'd recommend setting up a template sensor with value {{ states('sensor.integration_helper') }} so you can play around with the measurement and device class a bit in the UI and check it works first before stressing out about it too much

limpid jolt
#

Ah now I get what you mean. You mean to proxy the integral sensor through a template sensor, right?

sweet night
#

yup

limpid jolt
#

That seems to have mostly worked.

#

Bit of a round the house and through the kitchen to the mailbox approach, but sometimes it just is like that.

sweet night
limpid jolt
#

That sankey-chart already proved useful, apparently a large chunk of my L1 phase power is unaccounted for.

sweet night
#

exciting, good luck hunting

limpid jolt
#

We may have another problem. The integral sensor probably won't reset overnight...

sweet night
#

ah no, in which case stick a utility meter on it with a daily reset

limpid jolt
#

So I'll have an utility meter that is fed by a template sensor which in turn is being fed by an integral sensor? I'm beginning to get serious jenga-vibes here...

sweet night
#

I think you could point it at the integral sensor directly

#

Provided it's not listed as a "net meter" it should have the right device classes etc

limpid jolt
#

I'll see what I can do. the state_class attribute migh go wonky again there.

#

You wouldn't happen to know any plug-type energy meters that natively bring an usage sensor to the party? If I have to jump through all those hoops, it might be better to tackle the problem at the source.

sweet night
#

No sorry. I've never actually used the Sankey thing, just know people use it for this

limpid jolt
#

For the record, feeding an integral sensor into an energy meter yielded a state_class of total_increasing and no device_class or unit, so I may have to run it through a template sensor after all.

#

I'll have to let it roll over and see how it behaves on a fresh day.

sweet night
#

ok good luck!

limpid jolt
#

I'm beginning to suspect the diagram has a few gremlins of its own. The sum usage is less than the very sensors it's calculated from.

#

No wait, actually it's displayed as more. Getting screwy here.

limpid jolt
#

I must admit I was a bit sceptical about the sankey thing in the beginning, but I must say it's growing on me.

indigo portal
#

May i get the code to your helper device? i have the same issue and have tried to fix it for a couple days

limpid jolt
indigo portal
#

like what to put here (sorry for danish language)

limpid jolt
#

Ok.

#

Here's the sensor we want to integrate:

#

This is what the integral sensor looks like:

#

And this is what the energy meter looks like:

#

And that's really all there is to it.

#

Also I'll see your Danish and raise you some German

#

That should give you Wh as unit on the integral, and in consequence, also on the energy meter.

#

Oh and you may have to reload the UI for the new helpers to become truly alive.

indigo portal
#

Thank you, i have finally have had the time to set it up, no in a few hours ill se if it works.

#

Thank you in advance

deft mortar
# limpid jolt You wouldn't happen to know any plug-type energy meters that natively bring an u...

I was reading through old comments and saw your question for a plug-type meter that does energy metering and thought I'd give you an answer stil, as I think you'll benefit from having a hardware energy metering instead of the integral helper method: The integral helper works great as long as Home Assistant is up. However, as soon as HA is not available (restart, crashed, updating, etc.), any usage while HA is not fully available will not be accounted for in your energy metering. For this reason I personally think its better to have a hardware device doing the energy metering.
There are many plug-type devices that do metering. It depends on which protocols you have available to you which ones could fit you best. I'm guessing here you have European outlets, if you've got another type of outlets, you will need other plugs of course. Most manufacturers do also sell alternative plugs for other outlet types so you should be able to find some yourself. I'm not affiliated to Robbshop, they just have a nice selection in their assortment and a good search option in their site: https://www.robbshop.nl/slimme-verlichting/slimme-stekkers/alle-stekkers#twn|?tn_fk_ae-functies=Stroommeting.
Here are some examples:
If you've only got wifi:

  • Shelly Plus Plug S
  • Hihome Wifi Smart Plug (WPP-16R)
  • Aeotec Smartthings outlet wifi (AEOWP05)
  • TP-link Mini Smart wifi (TAPO P115)
  • WOOX R6118 (careful, woox also sells similar plugs without energy metering)
    Or if you've got Zigbee:
  • INNR SP240 (careful, INNR also sells similar plugs without energy metering)
  • Aqara Smart Plug
  • Philips Hue Smart Plug
  • NOUS
    Or if you've got z-wave:
  • Fibaro Wall plug
  • Neo Coolcam NAS-WR01ZE
  • Aeotec Smart Switch 6
  • Qubino Smart Plug 16A
    Or you could even go for Matter:
  • Shelly Plus PlugS Gen3
#

I mostly recommend to steer clear of any wifi plugs: they often require manufacturer specific addons to operate them from HA and often don't work that reliably. Zigbee has often very little installation or usage problems. I just have a problem with the fact that zigbee's implementation for energy metering has only a small number of bytes available for the returned values, making it that zigbee devices mostly only return Watts rounded to 0 digits and Energy readings that round to kWh: if you run a led light from it you may f.e. only get an update every few weeks or so. I have no experience with Matter. My personal favorite for usability is the Fibaro Wall plug: it is expensive, but it is small enough to have multiple devices next to each other and power and energy metering can go from a led light to your oven. I also tried the Qubino 16A, but that is bulky, plus it only sends an update every 0.1 kWh, which is annoying because it leads to 'untracked energy' for several hours, then negative untracked energy in a next hour in the individual devices usage in the energy dashboard.

grim idol