You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like the inverter sometimes sends invalid data (rarely but happens) which results in this script logging wrong values. Unfortunately we can't stop the inverter from doing that. However we can choose to ignore the invalid responses (at least I think so). This has happened to me 3 times but unfortunately I only have the raw response from one of the cases. However I believe it gives enough knowledge for implementing a fix.
The issue comes from that the script expects the response to have valid 0x03 function payload. For some reason, I've gotten at least one response where there's actually two 0x04 function payloads in front of the requested 0x03 function payload 🤔 I've removed some "personal" data from the images but here's an example of the valid response and one invalid response.
Valid modbus frame:
Invalid modbus frame:
Possible things to fix the script from logging invalid values:
Start reading the data and if the modbus frame doesn't start with the 0x03 function code, stop the script (or re-request the data and try again but remember to not create infinite loop in case the inverter keeps providing faulty data).
Start reading the modbus frame and ignore the invalid 0x04 function payloads until the correct 0x03 function is reached (can easily skip since there's the length right after the function code, then just also skip the two bytes at the end (registerEnd and Crc16)). The 0x03 function payload in my invalid response actually did have the correct updated data. Just it's not where the script expects it to be.
The comment here on the Serial in the header is interesting but I'm not sure if it would work for this.
As a side note, while investigating this issue, I found this (kubaceg/sofar_g3_lsw3_logger_reader#12) from another logger reader. I believe it's caused by this same invalid data.
The text was updated successfully, but these errors were encountered:
Thanks for spotting same problem in my logger. I'll make some additional log for bytes 26-27 to confirm corrupted function code. Hope this solution will have 100% of faulty readings cover because after my tests which was based on Faults there was some discrepencies where I had faulty readings without faults.
The LSW-3 (or wifi sticks in general) seem to not mutex the RS485 bus in this multi master setup, so Modbus frames from the logger itself querying the inverter resp sending frames to portal are mixed with your requests/responses.
It seems like the inverter sometimes sends invalid data (rarely but happens) which results in this script logging wrong values. Unfortunately we can't stop the inverter from doing that. However we can choose to ignore the invalid responses (at least I think so). This has happened to me 3 times but unfortunately I only have the raw response from one of the cases. However I believe it gives enough knowledge for implementing a fix.
The issue comes from that the script expects the response to have valid 0x03 function payload. For some reason, I've gotten at least one response where there's actually two 0x04 function payloads in front of the requested 0x03 function payload 🤔 I've removed some "personal" data from the images but here's an example of the valid response and one invalid response.
Valid modbus frame:
Invalid modbus frame:
Possible things to fix the script from logging invalid values:
As a side note, while investigating this issue, I found this (kubaceg/sofar_g3_lsw3_logger_reader#12) from another logger reader. I believe it's caused by this same invalid data.
The text was updated successfully, but these errors were encountered: