dmslabsbr / hoymiles

Hoymiles ADD-ON for Home Assistant
119 stars 30 forks source link

Incorrect values on meter_from_grid and meter_to_grid #154

Open xezpeleta opened 2 months ago

xezpeleta commented 2 months ago

Hi!

There is an issue with the meter values:

In Home Assistant I see the entities "meter_from_grid" and "meter_to_grid" have the incorrect value and they are updated once a day, when they should be updated every 15 min.

It appears that the JSON obtained from the API via hoymiles.py differs from that of the Hoymiles app.

2024-07-06 12-22-17

If we use Curl or the browser inspector, the JSON retrieved contains the correct values (which are updated every 15 min):

2024-07-06 12-21-52

Cosik commented 2 months ago

@xezpeleta you are wrong. Your are showing present values. Addon is providing values form begging so they are constant increasing type

xezpeleta commented 2 months ago

Hi @Cosik

Maybe I'm wrong, but If that's true, shouldn't both values update every 15 min?

In my computer I can confirm they are updating every 24h. So I can't use them for the Home Assistant Energy dashboard.

That's why I've started looking for the source of the issue, and I've discovered the JSON retrieved by the addon was different from the one loaded in my browser. I've changed the addon and I'm happily using the patched version.

If you prefer, we can wait until someone else confirm the issue.

Thanks!

Cosik commented 2 months ago

Dashboard on HM cloud are updating values every 15 minutes. So far request which were used was to get total value, not value from present day. Your PR changing request to totally different one. Example (I'm not sure how it works in different countries) but my energy supplier give me total readings from energy meter not usage per single day. Please check total readings in cloud and compare with addon.

xezpeleta commented 2 months ago

Ok, I see, then these entities aren't appropriate to use it in the HA's default energy dashboard.

Do you know which 3 entities should I choose to get the solar production, grid consumption and return to grid?

Cosik commented 2 months ago

They are correct. They should be marked as constant increasing so after about 24h energy dashboard in HA should count normally differences and show proper consumption. This dashboard was designed to use these values, I'm using it and it is calculated ok. Also people with whom I was adding support config proper calculation. Here is my entity ![Uploading Screenshot_2024-07-08-21-20-27-478_io.homeassistant.companion.android.jpg…]()

xezpeleta commented 2 months ago

I understand, so then you are getting "meter_to_grid" and "meter_from_grid" lefetime data on purpose.

In my opinion the main handicap is you can't see the evolution during the day and you get a value which is totally different from the HM cloud UI "to grid" and "from grid" info ( #148 )

Maybe the best solution to avoid breaking changes is to add two new entities. But probably nobody is asking this except me .. so forget it 😅

You can close the issue and the PR. Thanks for your job!

Cosik commented 2 months ago

Sorry I don't understand. Using this values you are able to see it. What is more you could add manual custom counter of energy which is reset every day. I also have it.

About extending addon there is information on Readme about situation.

Cosik commented 2 months ago

Ok, now I have access to PC and remember that ther is a bug in HM cloud database. It returns wrong values in total request and is visible also on HM UI. But in present implementation fixing it is not so easy as it is in Readme