JensenNick / huawei_solar_pees

Power, Energy and Economy Sensors in Home Assistant
MIT License
49 stars 5 forks source link

Utility Meters "jumping" #66

Open JensenNick opened 2 months ago

JensenNick commented 2 months ago

Under certain circumstances (which I still haven't identified) the ultility meters sensor.economy_nri_pv and sensor.economy_nri_battery introduce a significant "jump" in value. This also includes the related sensors with a cycle but not the (ts) input sensor. 2024-08-27_09-20-45

  economy_nri_pv:
    source: sensor.economy_nri_pv_ts
    name: "Economy - NRI PV"
    unique_id: economy_nri_pv
    net_consumption: true

and

  economy_nri_battery:
    source: sensor.economy_nri_battery_ts
    name: "Economy - NRI Battery"
    unique_id: economy_nri_battery
    net_consumption: true

My time to update/support/investigate is limited at the moment, but it could be one of the settings of the utility meter which is wrong/missing https://www.home-assistant.io/integrations/utility_meter/

JensenNick commented 1 month ago

This issue persists although this time it was my utility_meters based on sensor.energy_yield_total_ts that behaved. This behaviour is after I did some "development-work" on my running instance og HA. It has been running stable since July.

2024-10-09_16-51-18

I'm now testing if this correction will prevent the issue... "float(0)" changes to "float" for sensors with availability and an if-rule for sensor.energy_yield_2_ts. The challenge here is to incorporate a value for the 2nd inverter in those use-cases with only one inverter and not to have the sensor reset to "0".

      ## ----------------------------------
      ## Huawei Solar PEES - Energy Sensors
      - name: "Energy Yield #1 (ts)"
        unique_id: energy_yield_1_ts
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        state: >
          {{ states('sensor.energy_yield_1') | float }}
        availability: >
          {{ has_value('sensor.energy_yield_1') }}
      - name: "Energy Yield #2 (ts)"
        unique_id: energy_yield_2_ts
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        state: >
          {% if has_value('sensor.energy_yield_2') %}
            {{ states('sensor.energy_yield_2') | float }}
          {% else %}
            {{ 0 }}
          {% endif %}
      - name: "Energy Yield Total (ts)"
        unique_id: energy_yield_total_ts
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        state: >
          {{ states('sensor.energy_yield_1') | float +
          states('sensor.energy_yield_2') | float }}
        availability: >
          {{ has_value('sensor.energy_yield_1') and
          has_value('sensor.energy_yield_2') }}

Additionally I'm considering the option to ad periodically_resetting: false to some/all utility meters. I'd appreciate any input on the issue. Here is what "Claude" has to say...

2024-10-10_08-29-26

For testing I've added periodically_resetting: false to all Energy Utility Meters without a cycle, but according to Claud this should maybe be done to all utility meters.

sensor.energy_battery_charge sensor.energy_battery_charge_grid sensor.energy_battery_charge_yield sensor.energy_battery_discharge sensor.energy_battery_discharge_grid sensor.energy_battery_discharge_house sensor.energy_import sensor.energy_export sensor.energy_export_yield sensor.energy_house_load sensor.energy_house_load_grid sensor.energy_yield_1 sensor.energy_yield_2 sensor.energy_yield_total