Coder Social home page Coder Social logo

Comments (6)

GiorgioUghini avatar GiorgioUghini commented on May 27, 2024

Every midnight, while other statistics resets to zero (in the frontend, in the backend they are still counting energy), the two battery statistics reset to negative values (in the frontend, in the backend they are reset to zero as they are daily stats).
image

In HA documentation they say that they keep the initial value when the statistic is added, as zero-point... Don't know if this may be relevant?

from homeassistant-fusionsolar.

tijsverkoyen avatar tijsverkoyen commented on May 27, 2024

I think I will first need to read up on the documentation.
I don't think the Huawei Fusion Solar API exposes when the data is reset, for probably I will need to recalculate of take the current time or, ...

I don't have much time the coming weeks as I'm busy with other projects. So don't expect a change very soon.
Feel free to create a pull request yourself.

from homeassistant-fusionsolar.

GiorgioUghini avatar GiorgioUghini commented on May 27, 2024

Actually, Home Assistant recognize the "last reset" by looking if a "total increasing" sensor goes to zero. At the end the logic is clear: the sensor starts from zero, it is total and it is INCREASING, so it goes to (say) 20kWh, and if this sensor drops to 0, well that's a reset. HA is intelligent enough for this.
Problem is that there's something in the initialization phase that set the so-called "zero-value" of the sensor to the value that it has in that moment. In this way, when it resets, it goes back to the zero-value (so if you setup this integration at 4PM when you already produced 15kWh, every middnight, the dashboard will display -15kWh). Calculation is: actual value (0) - zerovalue (15) = -15.
I need to evaluate a possible solution for this too.
There's no hurry, your work is already excellent as is. Just putting the issue here if anyone would like to contribute. I will, as soon as I manage a possible workaround for this.

from homeassistant-fusionsolar.

GiorgioUghini avatar GiorgioUghini commented on May 27, 2024

Progress so far:

  1. Battery discharge capacity and Battery charge capacity are set to total, while they can set to total_increasing. See attached image. If sensor are kept total (without increasing) we should put in place routines to set last_reset based on drops to 0.
    image

@tijsverkoyen for this specific behavior (battery charge and battery discharge capacities) state_class to total_increasing will solve the issue. But, we should be able to make this reasoning for all statistics, for example, the daily_* or monthly_* entities provided by Huawei.

I'm guessing if I'm the only one with this behavior (or maybe I'm the only one with a battery tracked in HA energy dashboard?)

from homeassistant-fusionsolar.

GiorgioUghini avatar GiorgioUghini commented on May 27, 2024

Changing line 535 in sensor.py from FusionSolarRealtimeDeviceDataEnergySensor to FusionSolarRealtimeDeviceDataEnergyTotalIncreasingSensor would solve.
But, I'm not sure if doing so would break other things. It shouldn't, but who knows. I'm testing it locally on my HA istance - keep you posted.

from homeassistant-fusionsolar.

tijsverkoyen avatar tijsverkoyen commented on May 27, 2024

I have merged your PR.
I will create a PR in a few moments

from homeassistant-fusionsolar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.