macxq / foxess-ha

Home Assistant & FoxESS integration. Monitor you photovoltaic installation directly from HA ☀️ ⚡️
121 stars 37 forks source link

Second object gets first object data #232

Closed webmake closed 7 months ago

webmake commented 8 months ago

Describe the bug I'm not sure is it this plugin bug, or homeassistant, but one time I've noticed a weird graph, when there was no electricity in second object, and second object received first object data with time delay. And electricity came back at around 10o'clock. I saw that api data was correct, so maybe there is a mistake with entities.

Screenshots image

HA version: Home Assistant 2023.6.2

foxess-ha version: v0.36

FozzieUK commented 8 months ago

It's a weird one, almost as if no data results in it using the other inverters data ?.

Can I double check which entity you are looking at there - is that generation power on 2 different inverters ?

Can you use the Foxess cloud website and copy and paste the graphs of what each of the generation powers was doing during that same time period (that entity is called 'Output Power' in the fox cloud dropdown list)

webmake commented 8 months ago

I have some data logged at that time, not sure if this will help log_duplicated.txt

I tried to restart HAS at that time but data still was the same, and suddenly separated entities when inverter went online

webmake commented 8 months ago

Adding minimized and mapped logs log_duplicated_simplified.txt

FozzieUK commented 8 months ago

It’s a difficult one to test for - I would have expected the inverter status to have gone off-line and it would stop polling for variables but that doesn’t seem to be the case - i’ll setup a multi-inverter system and take a look at it. Can I double check that in your configuration.yaml ‘platform’ that you have a unique deviceID for each of the inverters.

FozzieUK commented 8 months ago

Update: I did a PR last year to change the way the ’old cloud’ integration handled the inverter being off-line (as it used to crash) - and that carried over into the open api version.

Basically the inverter status comes from the device detail call, this tells you whether the inverter is on-line, off-line or in-alarm.

If the inverter is off-line, variable polling should be suspended and the inverter sensor should change to ‘off-line’ and the entities shouldn't get updated - this would stop what you were seeing as there is no raw data to be handled when it is off-line as you can see in your logs where data is ‘[]’

I will handle that better so if the inverter becomes off-line it will make the entities for that specific inverter become unavailable (except inverter status which will change to state 3 ‘off-line’ ), stop raw data polling and retry the device detail every 5 minutes to monitor the inverter status.

I’ll test the changes to handle that and update in a few days.

FozzieUK commented 8 months ago

https://github.com/macxq/foxess-ha/releases/tag/v0.38 corrects this, when an inverter goes off-line it will correctly show the raw data entities as unavailable and the inverter status will show off-line.