-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration broke Home Assistant 2021.8.0 #16
Comments
I'm going to try it out on an empty home assistant environment to check whether it fails there as well. |
Configuration.yaml should look like this (example):
The latest core release of HA (core-2021.8.0 and higher) introduced a renamed parameter for Voltage (ELECTRIC_POTENTIAL_VOLT) !! So after installing using HACS you have to patch (if you are using core-2021.8.x): Do not forget to reboot. Btw what is your current ECU-R firmware version? |
Make sure you've added the WiFi connected IP-address to the configuration.yaml not the ethernet connected IP-address |
Thanks for the quick response! I have firmware 2.0xx I have validated the setup with a clean install of 2021.8.X with the changes you proposed to VOLT. I doublechecked the IP-address, which is the correct one. Still Home Assistant wouldn't start anymore. I have the following logs (checked with ha-cli:
Supervisor logs:
|
Ok, I tried again without an ethernet connection (so only WiFi is connected). Still the same response.. |
I also have the ECU 2.0 and problems with HA. It would not start sometimes. After disabling apsystems_ecur is coming back again. Has something to do with the unstable communication with the ECU which influence the startup of HA. |
There is sadly not much information in the debug logs of Home Assistant. It does not show the front-end, and in the log there is only the following message (regarding the custom_component).
Memory is blowing up however, so something is going wrong here. |
Yes I have the same. Processing or waiting on ECU seems like. |
Ok, I think I have an idea what the issue is. It seems that it will not get the correct ecu_id populated from the raw data. When I hardcode the ecu_id in the code it sort of works. It does not fetch the (correct) data, but at least it doesn't fail. It tries to get the data, but I think it has the same problem as getting the data from the ecu_id: the raw response seems to be different.
Home assistant logs:
Maybe an idea to:
Or trying different responses might also help? |
Taking a different code path for a 2.0 or PRO ECU shouldn't be a big deal if we can figure out how to decode the data. I took a look at the test script on the tweakers site, it doesn't issue the all the same queries the integration does. The first one the integration does is tells us the the ECU ID, firmware version, lifetime energy, today energy, current power, etc. This query is:
Can someone run that on the 2.0 device and provide the output of what is returned? |
Ok, I added a lot of debug messages in the code. I hardcoded the ecu_id. Getting the following messages (XXXX = ecu_id I put manually in (of course the correct one, not XXXX ;-) )
Looking at the code, it seems that it stops working when it is trying to get the inverter data. Looking at the functions and logic, it stops working at function
And then it stops at the try/except block on lines 95-96:
Anyone any idea what's going on? |
@ksheumaker When sending the
|
I'm assuming the XXXXXX are replaced with the correct ECU_ID? And on your question on lines 95-96 that's reading from the socket and awaiting a response. It should timeout after 5 seconds. But you can add a debug statement above the pass in the Exception block like this
And maybe we can get a little more details on if there was an exception and what it is |
Yes I replaced with the correct values ;-). The script never comes to the Exception block, I have a debug message there already, but it doesn't trigger/show up. |
There was some talk about closing the socket and re-opening it between queries? are you doing that? if not replace the async_query_ecu function with this:
|
I'm assuming this lines up with your system?
|
@ksheumaker Yes it does. I replaced the function with the new one. Looks better, no freeze until now, but still no (correct) data, but now there is a message abount inverter type 806!
|
Ok, what type do you have, are they QS1? If so add "806" to array at line 35. |
YES! Added '806' to the QS1 array and rebooted. Now getting all kinds of data :-) |
Shall I provide a pull request with the changes made? (new function + adding 806 to the QS1 data) |
Sure if you'd like to that would be great! |
Worked for quite some time today, but stopped working again (HA unresponsive).
|
This might actually be the same kind of issue: https://stackoverflow.com/questions/41932359/timeout-for-python-coroutines |
Tried to debug again. When I put the following in the function where it stops, I get the following. Seems that we need to create something to stop the while loop if the data is rubbish:
Debug logs:
|
I didn't mean to close this - I added a change to the latest version that incorporates the suggestion from the stack overflow post. Your ECU seems to be less reliable in sending out data than mine, since i've never run into getting 0 bytes back from the socket. Let me know if it helps you. |
Thanks for adding these changes! I have installed the latest version. It doesn't block Home Assistant, however, does not connect to the ECU. I tried manually and no 'asnwer' there either. It connects, provides the ECU_ID, but doesn't provide the inverter data. After I rebooted the ECU all started working. I suspect the ECU doesn't like all the requests or something. Maybe lowering the number of requests would help. Possible to enable a configuration that indicates the update_interval? I can do that with an automation, but integrated in the configuration would be slick. |
added support for adding
to the configuration, default is 60 if you leave it out. Let me know what value you seems to be safe with your ECU |
I had a static DHCP binding, and ECU didnt accept to offer after a while. Static Wifi IP is not possible, only for the LAN interface on a ECU-R. The router (dhcp server) was for sure not the problem (tested with spoofing the Wifi MAC address with old Wifi dongle). SO the ECU-R now is connected by LAN, but spontaneous loose connection after 72 hours. Reason not found yet. Can be that the socket is in use and not cleared by the HA ECU integration. You cannot verify it, because Arago account is not known (Arago is the OS op en ECU-R and able to telnet to it) |
The sync query contains socket close and can be used to try when you modify |
I discovered that this function reuses the same socket to send multiple commands, so that has to be rewritten... |
Didn't mean to close this, but I created a new version which will add a 1 second sleep between socket close and opens to try and prevent the ECU from being overloaded when using the ECU_R_PRO. Hopefully this will help, we can try increasing the sleep time as well to see if that helps at all. |
Cool, tx, I have it run. Will monitor from now on with ECU_R_PRO if it keeps working. Fingers crossed! |
@adriaanh I have the same one, from the gui this seems only like sunspec via modbus over the extra rs485 port. For me the drop down "Address" has the options for address assignments between 1-255. I think this is related to how modbus works. Can't find any modbus over tcp option in the gui, so only rs485 for now i guess. So probably the tcp/8899 is the way to go to read this locally for the time being, unless the sunspec rest option gets implemented someday... @HAEdwin does your older ECU-R, also have an RS485 port. next to the ethernet port? |
I can try. Then I need to buy a USB-RS485 adapter, like: https://nl.banggood.com/USB-To-RS485-Converter-Module-USB-To-TTL-or-RS485-Dual-Function-Dual-Protection-p-1311986.html?imageAb=1&akmClientCountry=America&channel=bg_affiliate&utm_source=bg_affiliate&utm_medium=aff&utm_campaign=giz1205_m_product_prdshare_copy&utm_content=CX08197269762201611W_10192&_branch_match_id=800497510816475964&akmClientCountry=NL&akmClientCountry=NL&cur_warehouse=CN |
Multiple changes were done in 1.1.2 to hopefully increase stability with ECU-C and ECU_R_PRO devices. Please update to the latest version and if you still have issues please open a new github issue. |
Any success? |
I didnt try it yet because of RS485 delivery delays. Should be nice if you can experience with the EW-11 is possible in combination with APS ECU_R_PRO. |
It's used all the time, I cannot repurpose it. |
For the scraper part, you can check my repo. https://github.com/tv3/homeassistant-apsystems_ecur It's a fork from this repo where I worked on getting rid of the whole tcp communications. With Kyle I wanted it to integrate into his integration, but it has been silent for some time. So I might work on a separate integration for any ecu with the internal web interface (I have an Ecu_r_pro). |
Yes I was thinking about your module too. Why haven't you refactored it based on the latest version of Kyle's module? Especially since he has been silent. |
BTW you didn't enable the Issues page on your repo. Also, your integration works just fine with the Ethernet address, the Wifi is not required. |
I know it works on both Ethernet and WiFi. Been running it for weeks. As for issues etc. There wasn't any plan yet to create a separate integration. If I do, I will first need to find some time to clean it up. For now it is still a copy of Kyle's repo with hacks from my side. |
Anyway I just installed it and it works just fine. |
Iirc there is a check on wether new data has arrived (time stamp check). |
Has you integration stopped working for you too in the last few days? Maybe after the latest update from HA 2022.4.x? I get
And
The Web gui works as usual. |
Same here. |
I restarted the ECU and now it works. @tv3 have you experienced anything similar recently? I find strange that the Web guide from the browser works but your integration, scraping the Web interface, doesn't, even after multiple restarts of HA. |
I just checked your repo and I see some test webpages. For info, my ECU-R-PRO does not offer the following ones anymore: old_energy_graph_monthly You are not using them, but for information... The bare ones: old_energy_graph are still working providing a text only summary. So I don't understand why your integration stopped working. |
@dewi-ny-je the monthly/weekly etc are not real URL's. you need to POST on http:///index.php/realtimedata/old_energy_graph |
Thanks. |
Today:
@tv3 |
You're probably using the socket implementation, instead of the http version of the query ecu function. |
I thought your version was only http, I have to check where's the setting for that. Thanks. |
I installed this integration via HACS and rebooted the system. After reboot, I added the following to my configuration.yaml. I have the ecu-r connected through wifi as per instruction and the secret has the ip address of the wifi connected ECU-r.
After rebooting, home assistant wouldn't start. I had to go back to a previous snapshot in order to get HA working again. No issues in the logs. Is this an issue with compatibility of home assistant?
I have the ECU-r with QS1 inverters, and connected both via WiFi and ethernet.
Thanks!
The text was updated successfully, but these errors were encountered: