zivillian / enverproxy

forked from https://gitlab.eitelwein.net/MEitelwein/Enverbridge-Proxy
8 stars 5 forks source link

Script crashing on receiving data #3

Closed ThinkPadNL closed 2 years ago

ThinkPadNL commented 2 years ago

The script seems to crash with the message ValueError: invalid literal for int() with base 10: 'aa998a57'

Complete logging:

2022-04-30 18:28:10,999 - Envertec Proxy - INFO - Starting server (v1.3)
2022-04-30 18:28:10,999 - Envertec Proxy - INFO - Starting mqtt loop
2022-04-30 18:28:11,000 - Envertec Proxy - INFO - mqtt loop started
2022-04-30 18:28:11,000 - Envertec Proxy - INFO - Entering main loop
2022-04-30 18:32:22,647 - Envertec Proxy - INFO - Inputready: [<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 1898)>]
2022-04-30 18:32:22,647 - Envertec Proxy - INFO - Entering on_accept
2022-04-30 18:32:22,648 - Envertec Proxy - INFO - ('192.168.6.46', 49157) has connected
2022-04-30 18:32:23,048 - Envertec Proxy - INFO - New connection list: [<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 1898)>, <socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.17.0.15', 1898), raddr=('192.168.6.46', 49157)>]
2022-04-30 18:32:23,048 - Envertec Proxy - INFO - Entering main loop
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Inputready: [<socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.17.0.15', 1898), raddr=('192.168.6.46', 49157)>]
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Main loop: 982 bytes received from ('192.168.6.46', 49157)
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - 982 bytes in on_recv
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Data received as hex: 6803d66810049002084400000000000000000000aa998a5722023c320000000179ec18a43a5232000240000000000000000000001112460322023bd5000000011924188e3a2931fe46dc0500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000516
2022-04-30 18:32:23,049 - Envertec Proxy - INFO - Data is coming from a client
2022-04-30 18:32:23,050 - Envertec Proxy - INFO - Processing Data
Traceback (most recent call last):
  File "/data/app/./enverproxy.py", line 315, in <module>
    server.main_loop()
  File "/data/app/./enverproxy.py", line 95, in main_loop
    self.on_recv()
  File "/data/app/./enverproxy.py", line 253, in on_recv
    self.process_data(data)
  File "/data/app/./enverproxy.py", line 212, in process_data
    response = self.extract(datainhex, wr_index)
  File "/data/app/./enverproxy.py", line 191, in extract
    if int(d_wr_id) != 0:
ValueError: invalid literal for int() with base 10: 'aa998a57'
2022-04-30 18:32:23,654 - Envertec Proxy - INFO - Starting server (v1.3)
ThinkPadNL commented 2 years ago

I gave the EVB internet access and registered it on the Envertech portal. I see data coming in there. Something weird is going on though, i have two micro-inverters (EVT248) and added them in the portal by their ID's. But one of them is not showing any output. But i know it is working because the total system output is higher than what one inverter can supply.

The strange thing is, the portal sees a third 'inverter', with this same AA998A57 id that is mentioned in the log from the script. What is going on here? 😆 2022-05-02 12_13_17

zivillian commented 2 years ago

I've pushed an update which should fix your error. To me it looks like either Envertec changed the serial number format or one of your microinverters has an error. I guess you see the third inverter, because the data is transmitted from the same source in a single update.

ThinkPadNL commented 2 years ago

Thank you very much, it works now!

2022-05-02 19:18:32,795 - Envertec Proxy - INFO - Entering main loop
2022-05-02 19:18:32,795 - Envertec Proxy - INFO - Inputready: [<socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.17.0.15', 1898), raddr=('192.168.6.46', 49155)>]
2022-05-02 19:18:32,795 - Envertec Proxy - INFO - Data received as hex: 6803d66810049002084400000000000000000000aa998a5722023d6e088c0001ba671c5d3a2e320202000000000000000000000011123654220239c201de0000b66c1d4d399a32000200000000000000000000001112460322023c9807f5000160711c8a3a0032020200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003616
2022-05-02 19:18:32,795 - Envertec Proxy - INFO - Main loop: 982 bytes received from ('192.168.6.46', 49155)
2022-05-02 19:18:32,795 - Envertec Proxy - INFO - 982 bytes in on_recv
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Decoded data from microconverter with ID 11124603
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Data is coming from a client
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Processing Data
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Decoded data from microconverter with ID aa998a57
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Decoded data from microconverter with ID 11123654
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Finished processing data for 3 microconverter: [{'wrid': 'aa998a57', 'dc': 30.71484375, 'power': 34.1875, 'totalkwh': 13.8250732421875, 'temp': 16.7265625, 'ac': 232.71875, 'freq': 50.0078125, 'remaining': '020000000000000000000000'}, {'wrid': '11123654', 'dc': 28.87890625, 'power': 7.46875, 'totalkwh': 5.70068359375, 'temp': 18.6015625, 'ac': 230.40625, 'freq': 50.0, 'remaining': '020000000000000000000000'}, {'wrid': '11124603', 'dc': 30.296875, 'power': 31.828125, 'totalkwh': 11.0137939453125, 'temp': 17.078125, 'ac': 232.0, 'freq': 50.0078125, 'remaining': '020000000000000000000000'}]
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Processed data for 3 microconverter
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Submitting data for converter: aa998a57 to MQTT
2022-05-02 19:18:32,797 - Envertec Proxy - INFO - Finished sending to MQTT
2022-05-02 19:18:32,797 - Envertec Proxy - INFO - Submitting data for converter: 11124603 to MQTT
2022-05-02 19:18:32,796 - Envertec Proxy - INFO - Submitting data for converter: 11123654 to MQTT
2022-05-02 19:18:32,797 - Envertec Proxy - INFO - Entering main loop

For reference, i am running on firmware EVB201-E-N-010. I have the EnverBridge EVB202, but in my router it identified itself with hostname EVB201. With this firmware the Set ID is not necessary, it discovers the micro-inverters itself.

zivillian commented 2 years ago

the output shows three inverters with different values for power and totalkwh - maybe you are seeing a third inverter installed by someone else nearby on the same phase. Do the values of all inverters change regularly?

zivillian commented 2 years ago

Regarding the display in the envertec portal, you may have triggered a bug by registering only two inverters and reporting three in a single message, but as far as I have looked at the portal this does not surprise me...

ThinkPadNL commented 2 years ago

I have blocked internet access for the bridge again and changed the server mode to 'local' now that the script is working. I am not planning using the portal again.

The aaXXXXXX id was already in the script output before i linked the EVB202 to the portal, so the issue has nothing to do with the portal. Do you know how to reset the bridge to factory default? Maybe that way the aaxxxxxx ID inverter will disappear.

The aaXXXX is a real inverter, because combined with the other inverter, the sum (Watt) matches my external Sonoff meter.

EDIT 2024: The aaXXXX inverter went defective a while ago, the replacement one has the correct 1112xxxxxx formatting.