Codegnosis / givtcp-battery-card

A simple battery card for Home Assistant for GivTCP users
MIT License
8 stars 1 forks source link

Card doesn’t take account of kW unit of measure #21

Closed gcoan closed 8 months ago

gcoan commented 9 months ago

Checklist:

**Release with the issue: v0.1.8

Last working release (if known):

iOS companion app and directly with Safari

I recently changed the unit of measure for all my sensors to be consistent on using kW everywhere.

noticed that the card is indicating charging at 2W not 2KW - appears not to be taking account of the sensor’s unit of measurement

44E6D02F-6F57-45C3-ACEE-8EA695FF70A7

Description of problem:

Javascript errors shown in the web inspector (if applicable):

Additional information:

gcoan commented 9 months ago

It’s the givtcp_xxxx_battery_power sensor that’s being read but not taking account of the unit of measurement being W or kW. The card assumes that the entity is always in watts

Codegnosis commented 8 months ago

Hi - unfortunately I haven't been able to reproduce this. With GivTCP v2.4.3, the givtcp_INVERTORSERIAL_battery_power always seems to return the power in Watts.

However, I'll keep investigating though to see if there is something in particular that triggers this scenario

gcoan commented 8 months ago

Thanks for looking into it, I had to change givtcp_xx_battery_sensor UOM back to watts for the card to continue working.

Here's the card now: image

and the sensor: image

If I change the UOM on the sensor to kW: image

the card still thinks its reading the battery power in watts, not the kW its been set to: image

Unfortunately I am on GivTCP 2.4.1 as 2.4.3 crashes with with "can't find serial number". Weirdly it does this on one of my two inverters not the other, but it stops working almost as soon after I upgrade. I have raised an issue on GivTCP over this bug as I'd like to upgrade, but still no response from brikkat

Codegnosis commented 8 months ago

Thanks for the info - where is the UOM info changed/condifured from W to kW in HA? Perhaps I can have a play and see what I can do. If the w/kw value is saved in the givtcp_INVERTORSERIAL_battery_power attributes, it should be relatively trivial to modify the code and support this for you

gcoan commented 8 months ago

If you go into integrations/entities, search for the entity _battery_power

Click it (the right one, there are a few similarly named) to you see the details

Click the cog to edit the sensor

Then UOM is third entry on the screen, can change it between kW and W

Click Update to save

I assumed it would be straight forward to add this, thanks

gcoan commented 8 months ago

Thanks for the fix, it appears to work perfectly, I can change the battery power between kW and W and the charge rate always shows as 2.4kW