Tell us something about which inverter you have. 670 is not added as an inverter type yet. Is it a QS1,YC600, YC1000, DS3 or…
My ECU-R is still running on version 1.2.19
Hopefully the new version will fix the recurring and nightly “unavailable” issues.
The types I use are the YC600 de QS1 and the Ds3.
The number 670 I get out of the log in Homeassitant, see the second part of my mail, and youre right, it points to an inverter I assumt it pointet to the ECU, did not red it wriht. Stil I don’t know what it means.
I powerstarted the ECU several times bud no result, no connection.
One of the inverter ID’s starts with 670… add 670 to the code in APSystemsSocket.py
Line 45…48
self.qs1_ids = [ “802”, “801”, “804”, “805”, “806” ]
self.yc600_ids = [ “406”, “407”, “408”, “409” ]
self.yc1000_ids = [ “501”, “502”, “503”, “504” ]
self.ds3_ids = [ “703”, “704” ]
You will notice 670 is not close to one of the series above. Are you able to match 670 as starting digits with one of the inverters? If so which model?
I don’t consider this as an issue, I have analyzed what the ECU does and it is very intensively communicating with the EMA site updating missed dataframes, checking and OTA updating firmware. So I can imagine the processor is dedicated to keeping all data on EMA up to date and clearing the internal data cache. The inverters are down so no new data will be received by the ECU.
I understand what you are saying, but what I don’t understand is why every night at almost the same time the ECU-R becomes unavailable. From 00:59 till 02:45, from 04:26 till 05:41 and from 06:27 till 08:43 every night. +/- a few minutes.
Also every night at 02:38 sharp, the ECU-R reconnect its WiFi connection. This is for maintenance I guess.
I’m just telling what I see… that’s all.
Hi,
I have used the integrations succesfully for a few days. Until the ECU disconnected. I reinstalled the intergartion but get this error when I enter the IP adres.
Traceback (most recent call last):
File "/config/custom_components/apsystems_ecur/APSystemsSocket.py", line 212, in check_ecu_checksum
checksum = int(data[5:9])
ValueError: invalid literal for int() with base 10: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/apsystems_ecur/config_flow.py", line 45, in async_step_user
test_query = await self.hass.async_add_executor_job(ap_ecu.query_ecu)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/apsystems_ecur/APSystemsSocket.py", line 158, in query_ecu
data = self.process_inverter_data()
File "/config/custom_components/apsystems_ecur/APSystemsSocket.py", line 287, in process_inverter_data
self.check_ecu_checksum(data, "Inverter data")
File "/config/custom_components/apsystems_ecur/APSystemsSocket.py", line 217, in check_ecu_checksum
raise APSystemsInvalidData(error)
custom_components.apsystems_ecur.APSystemsSocket.APSystemsInvalidData: Error getting checksum int from 'Inverter data' data=b'' ``
Does someone know what the problem is?
Please tell us more about the integration version, firmware version etc.
The version of the integration is: V1.2.11. I don’t know where to find the firmware version of the ECU?
If you have this logo on the back of the ECU-R your firmware will be ECU-R-Pro
The query it executes delivers an unexpected empty response from the ECU which is misinterpreted and an error is raised. There is no cached data available yet so the integration fails. Try powercycle the ECU to see if this solves the issue. It is still a mistery why the ECU-R-Pro has this issue but work to bypass this using a HTTP call to the webinterface on the ECU-R-Pro is in progress. It could also be a timeout on the receiving part because this has not been tried yet. If you know how to edit APSystemsSocket.py you could try (only) adding self.sock.settimeout(self.timeout)
at the locations pointed in Use timeout on send and receive · Discussion #50 · ksheumaker/homeassistant-apsystems_ecur · GitHub restart HA after editting. For ECU-R and ECU-B owners there is no issue with the integration. Please let us know what the results are so we can rule out this option.
I have the exact same problem as you. Exactly the same error message in my log.
To get it working again, I have to downgrade the integration version in HACS. You can try it too and see if it works for you:
- Go to the HACS in Home Assistant and click on Integrations
- Click the three dots on the APSystems ECU-R
- Click Redownload and then select version 1.1.2
- Restart Home Assistant and set up the integration as you would normally
- Verify that everything works
- Go back to HACS in Home Assistant and click on Integrations
- Click the three dots on the APSystems ECU-R
- Click Redownload and then make sure Show beta versions is enabled, and finally select version 1.2.10 from the drop-down. Do not select 1.2.11.
- Install the integration and restart Home Assistant
This method works for me every time.
I have an ECU-R-Pro with firmware 2.0.5.
I’m probably doing something wrong here by adding self.sock.settimeout(self.timeout) to the four places in APSystemsSocket.py (or as close to as possible) in version 1.2.11, but it did not work for me. Produced a whole new error though when setting up the integration:
2022-03-08 11:54:11 ERROR (MainThread) [custom_components.apsystems_ecur.config_flow] Unhandled exception: 'APSystemsSocket' object has no attribute 'sock'
Traceback (most recent call last):
File "/config/custom_components/apsystems_ecur/config_flow.py", line 45, in async_step_user
test_query = await self.hass.async_add_executor_job(ap_ecu.query_ecu
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/apsystems_ecur/APSystemsSocket.py", line 130, in query_ecu
sock = self.open_socket()
File "/config/custom_components/apsystems_ecur/APSystemsSocket.py", line 121, in open_socket
self.sock.settimeout(self.timeout)
AttributeError: 'APSystemsSocket' object has no attribute 'sock'
Yes this worked for me! Thank you!
APSystemsSocket.py contains this part right?: data = self.sock.recv(self.recv_size)
Can you post the code from where def read_from_socket(self):
starts and def query_ecu(self):
starts (everything inbetween?
Sure! This is now from the modified APSystemsSocket.py from version 1.2.11:
def read_from_socket(self):
self.read_buffer = b''
end_data = None
self.sock.settimeout(self.timeout)
while end_data != self.recv_suffix:
data = self.sock.recv(self.recv_size)
if data == b'':
break
self.read_buffer += data
size = len(self.read_buffer)
end_data = self.read_buffer[size-4:]
return self.read_buffer
def send_read_from_socket(self, cmd):
self.sock.settimeout(self.timeout)
self.sock.sendall(cmd.encode('utf-8'))
try:
return self.read_from_socket()
except TimeoutError as err:
self.close_socket()
msg = "Timeout after {self.timeout}s waiting or ECU data cmd={cmd.rstrip()}. Closing socket."
self.add_error(msg)
raise
def close_socket(self):
if self.socket_open:
self.sock.settimeout(self.timeout)
self.sock.shutdown(socket.SHUT_RDWR)
self.sock.close()
self.socket_open = False
def open_socket(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.settimeout(self.timeout)
self.sock.connect((self.ipaddr, self.port))
self.socket_open = True
Hi to All,
I’m new here and looking at the amazing work has been achieved here regarding pulling data out of the ECU-R. I’m trying for a few days now to change the ‘APSystemsSocket.py’ to run alone (by entering the IP address in the script) and getting a JSON-dump as output. Unfortunatly I’m not much of a programmer and are stuck. Can someone get me on my way?
That’s weird because with a fresh install of 1.2.11 line 120 does not produce an error does it? On that line self.sock.settimeout(self.timeout) is also used and first called so it must also be correct using it elsewhere. Guess we have to wait until a complete release might have set this timeout setting for the other functions. Like I suggested here: Use timeout on send and receive · Discussion #50 · ksheumaker/homeassistant-apsystems_ecur · GitHub
in earlier posts we had something that worked standalone, maybe a start?
Thank you for the information, I’ve found a similar post from August last year:
To test this out outside HA i just add at the end :
ecu = APSystemsECUR("192.168.1.220")
data = asyncio.run(ecu.async_query_ecu())
print (data)
I can get the data from the ECUR and HTTP versions and its running now.
Hi, How would I update/change the IP Address or the Scan Interval after I have installed the integration?