jaroschek / home-assistant-myuplink

Custom Home Assistant integration for devices and sensors in myUplink account.
44 stars 10 forks source link

BUG: Incorrect unit: kWH (should be kWh) #166

Closed JvdMaat closed 4 weeks ago

JvdMaat commented 1 month ago

Just had to remove and re-add the myUplink integration and HA Repairs notified me of the incorrect units on a sensor that was previously correct. In my instance, it's the following sensor: Power, Savings & Efficiency kWH Saved (147) image image In addition, HA is also alerting me that there were long term statistics for this entity previously, but it currently does not have a state class, and thus no longer has long term statistics.

jaroschek commented 1 month ago

@JvdMaat The unit is currently taken directly from the API response value unit of the device parameter.

It seems that the unit for this entity was changed wrong by the manufacturer (or whoever manages the API for your device).

The wrong unity does also result in false entity detection which causes the problem with th long term statistics.

I will try to add a compensating logic to solve this and avoid similar character case issues in future.

jaroschek commented 1 month ago

@JvdMaat Please give the latest pre-release a try: https://github.com/jaroschek/home-assistant-myuplink/releases/tag/1.5.1-rc1

With this change I try to compensate the possible character case issues in the parameter units by and returning internal units from HA, if they can be matches case insensitive.

JvdMaat commented 1 month ago

I have reached out to the manufacturer (Enertech) to let them know about this typo (It also shows up in my myUplink web view) and requested they fix it. But no telling how long that will take. I appreciate the fix. Not in a position to manually upload that to my HA instance (And I can't figure out how to turn on HACS beta versions anymore in the new HACS 2.0). I'll check it once 1.5.1 comes out.

jaroschek commented 4 weeks ago

@JvdMaat I have made a new release 1.5.1 after testing the change for one day by myself. Please give it a try.

JvdMaat commented 4 weeks ago

Works like a charm. That (147) sensor is now showing kWh in HA (And still kWH in myUplink) Thanks! (No word back from Enertech, aside from "Thanks for letting us know, we've sent it to the engineering team"). But hopefully they'll fix it on their end as well. But consider this issue closed as fixed through 1.5.1.