tv3 / homeassistant-apsystems_ecur

Home Assistant custom component for local querying of APSystems ECU-R Solar System
6 stars 0 forks source link

Total lifetime energy stopped working after update #4

Open PascalvanDongen opened 2 years ago

PascalvanDongen commented 2 years ago

I just started using your plugin this week. Thank you very much for it, your plugin is the only one that works for me with my ECU-R-PRO.

However, after I updated the plugin via HACS today, the total lifetime energy went to 0. I reverted the update by changing line 77 in __init__.py with data = await self.ecu.async_query_ecu() again. It fixed the issue for me, so I think that is a bug in the code. I'm not that much of a programmer myself, so I don't know how to fix the bug. I just wanted to let you know that the recent update doesn't work for me.

Thank you very much for your work on this project!

Happy Easter, Pascal

tv3 commented 2 years ago

I don't think my version is on HACS. So maybe the original integration was put in place again?

PascalvanDongen commented 2 years ago

I added your repository manually to HACS as a custom repository, in order to easily install it. I got a notification that I could install update 4aa0d2a. I reverted the update by manually changing line 77 in the file editor in Home Assistant. That change made it work again.

dewi-ny-je commented 2 years ago

I got a notification that I could install update 4aa0d2a. I reverted the update by manually changing line 77 in the file editor in Home Assistant. That change made it work again.

Very strange. That commit didn't change any file, it only added a ZIP file with the integration. If it was working before the update, it should also afterwards.

Moreover, the integration you had before the update was using http querying, required for ECU-R-PRO. You changed manually to the old querying method which was causing more troubles.

Is it still working after few days?

PascalvanDongen commented 2 years ago

The commit that added the zip file was 2853d7e, the most recent one. If you look up commit 4aa0d2a, the commit that comes before the most recent one, you can see there is a change made in __init__.py. The bug arose after that change.

I tried to use http querying again after a few days, to see what happens, but my total lifetime energy produced went to 0 again. I had to change it back to async querying. That hasn't given me any problems so far.

PascalvanDongen commented 2 years ago

I do want to add that the integration, in the way I am using it (async), has stopped working randomly about 3 times in the 3 weeks that I am using it. I completely forgot to mention this. I wasn't able to connect to the ecu-r anymore. After some trying around, I was able to fix it by rebooting the ecu-r.

I don't know if this is a known issue when using async, but to be sure I am testing the integration as it is posted on Github (with http querying) now. I still don't have the "ECU lifetime energy" entity working, it is still at 0. For the time being I will use the "ECU today energy" entity to supply the data to the Home Assistant energy dashboard.

dewi-ny-je commented 2 years ago

With async I also have the issue with connection lost after few days. I didn't try http yet because while trying to understand the issue I switched back to the parent project (by kshoemaker) which has worked since.

I'll go back to this fork by tv3 as soon as these issues are solved because I'd like to avoid using WiFi, a requirement for the parent project.

tv3 commented 2 years ago

I forgot to mention this: lifetime_energy is not exposed in the internal web interface, so it is not populated. You need to use today_energy as the solar input for HA. The fact that the ecu-r hangs is due to the way the original integration accesses the data on the ecu. Thta' swhy I created this alternative. I do know my repo is a bit of a mess, as it was initially just a 'hack'. Will need to cleanup the explanation and lots of other stuff. So best way forward.

dewi-ny-je commented 2 years ago

To make your life easier and to make clearer the scope of the project, why don't you remove altogether the async code and description from the Readme, so that the mode of operation identical to the parent project is gone? WiFi+async+... -> kshoemaker WiFi/ethernet http scrape -> this one

tv3 commented 2 years ago

I first wanted a working version. That was successful. Later I created/uploaded the forked version. The plan was to integrate back into kyle's repo. But he can never test my part, so my plan is now to change my repo to be standalone.

And this all takes time and effort.