Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ac_meter Total Watt-hours Exported sign issue #249

Open
DooMMasteR opened this issue Feb 4, 2024 · 5 comments
Open

ac_meter Total Watt-hours Exported sign issue #249

DooMMasteR opened this issue Feb 4, 2024 · 5 comments

Comments

@DooMMasteR
Copy link

Version of the custom_component

0.025

Configuration

image

Describe the bug

ac_meter Total Watt-hours Exported is a huge value, slowly lowering whenever electricity is exported
image

@dp2008
Copy link

dp2008 commented Mar 19, 2024

Have the same problem with Kostal Smart Energy Meter
there seems to be a fix for openHAB but nothing for HA:
https://community.openhab.org/t/solved-wrong-values-with-modbus-and-kostal-smart-energy-meter/99785

see last comment form Oct 2022:
the Kostal SEM reports Exported Real Energy as signed int32 instead of unsigned int32, which makes it report bad values.
Same happens in Home Assistant and with the official Sunspec verification tools.

@DooMMasteR
Copy link
Author

Yeah I already tried to get KOSTAL to fix the issue in firmware, but they are super shitty at supporting their products.

@guidoffm
Copy link

guidoffm commented Jul 21, 2024

I have the same problem with the Kostal meter. I found a workaround, until a compliant firmware is available: You can install the Node Red add-on. Then, you can read out one of the wrongly interpreted values, convert it to the correct value, and then send the corrected value to a new virtual sensor in Node Red.

The conversion function is quite simple:

function convert(v){
    return -(v << 0);
}

The << operator converts the uint32 to int32, and the - sign makes the value positive again.

@Canonip
Copy link

Canonip commented Mar 25, 2025

My workaround of Kostals shoddy programming is the following:
total_increasing is important, otherwise it won't show up in the energy dashboard

template:
  - sensor:
      - name: "Ksem ac_meter Total Watt-hours Exported Corrected"
        unique_id: "ksem_ac_meter_total_watt_hours_exported_correct"
        device_class: energy
        state_class: total_increasing
        unit_of_measurement: Wh
        state: >
          {% set value = states('sensor.ksem_ac_meter_total_watt_hours_exported') | int %}
          {{ 4294967296 - value }}

@DooMMasteR
Copy link
Author

Yeah, I am really disappointed that they still have not fixed this fundamental issue.

I am now using the readout of a Deye inverter that we also added to our installation, that has a separate rs485 meter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants