CJNE / ha-myenergi

Home Assistant integration for MyEnergi devices
MIT License
139 stars 31 forks source link

Allow Configuration of W vs Kw for energy sensors #369

Open gpshml opened 1 year ago

gpshml commented 1 year ago

I have inverter settings which are in Kw and for ease of display on dashboards it is neater to show #.#Kw.

It would be great if we could select Kw or W, or allow the HA UI to change it as it does with other sensors.

I could duplicate the sensors and change the measure which I will do but not sure why the integration does not allow it to change..

Great integration BTW, thank you.

LeiChat commented 1 year ago

I am keen to learn more about Integration development too.

Might be related to the sensor device class?

Energy / Power?

https://developers.home-assistant.io/docs/core/entity/sensor?_highlight=units&_highlight=kw#available-device-classes

gpshml commented 1 year ago

It does show up as power and you can select Kw, it just doesn't take effect.

LeiChat commented 1 year ago

It does show up as power and you can select Kw, it just doesn't take effect.

I have observed the same... any ideas why?

Could the options be specified as an array?

In this repositories code there are a couple of instances of POWER_WATT. I found a thread on community.home-assistant.io that mentions POWER_KILO_WATT also being a valid unit. I would assume it needs defining to match the value the unit is in by default?

image

LeiChat commented 1 year ago

Had a look at GivEnergy integration this morning and noticed reference to a native_unit_of_measurement. Might that perhaps define the sensor's value without preventing it from being converted?

image

G6EJD commented 1 year ago

Obviously it won’t change the value just the units used for interpretation, so if the value is in Watts say 100W and the units are changed to eg kW then the result will be 100kW

jdunneirl commented 9 months ago

any solution here?

LeiChat commented 9 months ago

@gpshml Are you able to amend the title of the issue to "power sensors" rather than "energy sensors", please? Each time I get a notification I forget we've already covered the power vs energy unit thing.

jwillemsen commented 3 months ago

Native unit should solve this, when the user selects a different unit in the UI then HA will do a conversion