jello1974 / duosidaEV-home-assistant

Duosida D EV Charger Integration
MIT License
6 stars 3 forks source link

Bug with power #1

Closed gajotnt closed 1 year ago

gajotnt commented 1 year ago

Hello there, my trip got delayed a couple of days and i got time to test this

everything works great so far but the power isnt right.

It should display 2.6kw and its displaying 2600kw I have another sensor (Zoe) that shows the correct wattage Power diference Screenshot 2023-03-05 003558 If i change the unit from Kw to W: Screenshot 2023-03-05 0035581

Maybe its DuoSida thats giving the wrong number, or maybe in the integration something is being misscalculated?

Edit: In the D's charge app the power show correctly

Screenshot_2023-03-05-02-54-08-35_a1b04ade13b213170352e8cdc86048f6

gajotnt commented 1 year ago

https://github.com/jello1974/duosidaEV-home-assistant/blob/main/custom_components/duosida/duosida.py

Maybe this should go from this:

    DuosidaSensorEntityDescription(
        key=DeviceDetail.POWER,
        name=f"{NAME} Power",
        device_class=SensorDeviceClass.POWER,
        state_class=SensorStateClass.MEASUREMENT,
        native_unit_of_measurement=UnitOfPower.KILO_WATT,
        get_native_value=DuosidaDevice.get_device_power,
    ),

To this?

    DuosidaSensorEntityDescription(
        key=DeviceDetail.POWER,
        name=f"{NAME} Power",
        device_class=SensorDeviceClass.POWER,
        state_class=SensorStateClass.MEASUREMENT,
        native_unit_of_measurement=UnitOfPower.WATT,
        get_native_value=DuosidaDevice.get_device_power,
    ),

Dont know how to code, just had a look on your code and... well i tried... xD

jello1974 commented 1 year ago

Hello,

Yes you’re wright. I didn’t use that sensor so i didn’t notice that issue.

The change you made should resolve the problem.