#How can I create an energy sensor from a device that only provides W?

1 messages · Page 1 of 1 (latest)

jolly thistle
#

I’ve reviewed the documentation for the Energy Integration and noticed that the example provided relies on configuring configuration.yaml.

I’d like to know:

  1. Is it possible to set this up entirely through the UI? If so, could you provide guidance or steps on how to do so?
  2. I’ve explored the Riemann Sum Integral Sensor Helper but found it confusing when trying to replicate the YAML configuration. Is there a UI-based equivalent or a simplified approach to achieve this?
    Any advice or clarification you can provide would be greatly appreciated!
fading bison
#

Yes and yes

#

Heading to Devices & Integrations > Helper let's you create nearly all the entities you could think off.

#

Create an integral/riemann one from your W sensor with the left sum configuration if I recall.

#

Add another consumption meter helper on top to ignore negative changes / set periodically resets

median fossil
jolly thistle
fading bison
#

Not really
your sensor --> integral sensor --> utility meter sensor

#

The integral contains a calculated kwh value based on your sensor

#

The utility meter applies additional filters on top of the integral sensor

#

The utility meter is the one you would add to the energy dashboard

jolly thistle
#

so I have the W sensor and I create a sensor on top of it ant then I create a utility sensor on top of that? This does not seem intuitive to me :/

fading bison
#

Why not?

#

It's functionally based on previous sensors data, each of which does entirely different things

median fossil
#

You don't need to do the utility meter just to get it in the energy dashboard, just integrating the power into energy is sufficient

#

The energy dashboard is just a bunch of utility meters in a trenchcoat anyway

fading bison
#

this is mandatory if your sensor can measure negative values of production

median fossil
#

Which very few will though

jolly thistle
#

ok last few days have been wildly busy. Sorry for not acknowledging your responses. Have I understood this correctly?

jolly thistle
#

Seems not as it doesn't appear as an option for the energy monitor

jolly thistle
#

I cannot understand this. All I know is I want to measure power usage and all I have is this.

fading bison
#

Well yes you use the power sensor with the helper entities as mentioned

jolly thistle
#

but it doesn't create a sensor that the energy configuration can use

fading bison
#

If the state? (the one that should list power for your input) class is set properly on your input sensor it will be set properly on the output one

jolly thistle
#

would it show a W if state wasn't set correctly? I mean it SAYS it is.

#

unhelpfully for testing it does seem to be stuck.

jolly thistle
#

hmm.. changing now.. had to go into the tuya smart app and look at it from there before it sprang back to life

fading bison
#

that's just the normal tuya experience

#

No you want to use the dev tools > state to check what the entity has as properties

jolly thistle
fading bison
#

yes that seems about right

#

so if you create the integral sensor it doesnt have a device_class?

jolly thistle
#

I think it becomes kilowatts

#

which is still not something the energy sensor can use

#

can we employ carrier pigeans to speed up our interactions? The delays between our responses are wild

median fossil
#

Integrating W (with the k prefix and hour time) will give you kWh

ember imp
ancient helm
#

And sleep, and have work, and all those other pesky things - plus may be in a different timezone

opaque topaz
delicate void
#

meanwhile a carrier pigeon is needed to get a response it seems

astral kayak
#

whilst his point about speed of response was a bit off.
I do agree with him about the complexity of converting W into kWh within HA... it is needlessly complicated. I also have issues in this area and just gave up (the units were not correct)

why oh why is it so hard sometimes

fading bison
#

It's not a conversion of values it's a continuous calculation that is required. Which is what those helpers offer to do for you. All that is needed is to put the input sensor in there and have it do it's magic.

#

The better approach to this would be to have those kind of entities be created by the integration directly in which case you would need to file an issue/request against that integration in question

astral kayak
median fossil
#

It's not actually very complex. He just didn't do what @fading bison told him to and then complained that not doing it didn't work

median fossil
astral kayak
#

I fully agree that he didn't follow, but it really isn't simple... and this is coming from a person that has spent 20+ years building automation systems for oil refineries

#

if what you have follows the exact expectations of HA it's fine... but if you put one foot outside that it is way too complicated (is MQTT, BACNET, etc)

median fossil
#

How could it be made more simple? "put your power sensor into the helper that gives you the accumulated energy" is about as simple as it can be

fading bison
#

Theoretically the energy dashboard could advise what to do when people try to add a power sensor, but then we would have a lot of people asking why it's not showing the live values as they would think it does

#

Luckily HA offers various solutions for similar issues, the easiest of which is trusting the helpers followed by customization overrides.

astral kayak
#

hence why at the moment I have had to built a huge YAML to get everything into the exact format HA wants

median fossil
#

What actual issue do you have?

astral kayak
#

mostly UOM

fading bison
#

The units are of an issue?

median fossil
#

The output of an integral is units of input sensor * time unit of integral

astral kayak
#

source is either proving blank or not is the right format. Hence stick with chaos

median fossil
#

What's providing the source?

astral kayak
#

in other cases I need to calculate the kWh in HA, but then it is an integer that HA doesn't allow to add a UOM

fading bison
#

That sounds a lot like an issue that should be solved on the integration

astral kayak
fading bison
#

If garbage goes in garbage comes out. This is the case for broken data and as it seems also for missing units

#

The fix is to provide the units in the first place

astral kayak
#

basically I get a kWh from BACNET, that is driving 12 AC indoor units.
I then divide the kWh across indoor units based on what are operational and their capacity.
hence I have 12 calculated kWh's

#

so each output goes to a input number, then an integral hanging off that

fading bison
#

I can't follow why this would be difficult to pass along the unit in this case. I assume you use the template helper which has a field for you to set the unit of the value it outputs

median fossil
#

Why are you integrating kWh? You should integrate kW to get kWh...

fading bison
#

If you do the yaml directly you can also just specify the unit as part of the sensor there. Or in the third option as part of the customization override

astral kayak
median fossil
#

What is the input number for?

astral kayak
fading bison
#

As long as you use helpers they should show up as customizable entities in the ui even

astral kayak
#

the other issue is some of my devices have the right units, but do not have the right device class

fading bison
#

For the output of templates specifically it can't do the assumption for you as you could be turning water drops into volume of air displacement

astral kayak
#

so for those I dive into YAML to manually set it

fading bison
#

That is again something that should be fixed as part of the integration and not really by you in post

astral kayak
#

agree

median fossil
fading bison
#

If those are common devices ready to purchase you can file an issue/request against the integration to resolve this

#

If it's auto discovery related though more standard apis it's best to contact whoever makes the software for the device in particular

astral kayak
#

the ZigBee wild west

#

the only way would probably some workaround added into Z2M

fading bison
#

It never hurts to mention the existence of those devices and their missing properties so it can be resolved for other people as well

astral kayak
#

Ive been using HA since 2017, it's great, love it. And basically everything is possible... it's just sometimes we seem to make things difficult

#

often the answer is that it can already be done and that's normally true. But also I feel we need to also make things easier as well

median fossil
#

You mean like using an automation to set input numbers rather than just use a template sensor...

astral kayak
#

I know the team are constantly working towards that, but obviously The team is only so big

astral kayak
#

I had to create lots of them to map my BACNET climate devices to HA... it's not simple

median fossil
#

Joe Blow also probably doesn't care about guessing the energy consumption of various subunits of the sensor he's monitoring though

#

The thing I'm struggling with here is... What is the solution you want?

astral kayak
#

haha

median fossil
#

What does "better" look like in this situation?

astral kayak
median fossil
#

Which means what exactly?

#

What properties do you want to override on what entities that you can't currently do?

fading bison
#

aswell as declaring things as part of the sensor

astral kayak
#

hmmmm... when did this slip in 😂😂😂

#

not to doing like "the other guy" but I might have to check that out tomorrow, it's 2am here

fading bison
#

Around 2020 i think ^^

astral kayak
#

ahh I was in Russia then (seriously)

fading bison
#

Always better to find out something late than never

astral kayak
#

I will definitely check it out, if that really works for me then.... free emoji cake for everyone

astral kayak
#

I could send you a cake... but it might be green when it arrives