Closed cdpuk closed 2 years ago
Fascinating, I've not seen that before. So the reason the log lines are correct is because the protocol contains the inverter serial twice 🤦 . Once as part of the standard header for reading back any set of registers, but then also as part of InputRegisters
when you read back locations 13-17. It is the latter that seems to be failing, which would be quite interesting to debug. It should already be identifying serials starting with ED
as Gen2
, so throwing an exception here is actually good – clearly there's something funky with the register decoding going on based on the exception you pasted.
If you'd be up for it, supplying the raw RegisterCache would be useful for me to try and debug it – you should be able to do .inverter_rc.to_json()
and pass that back to me. GitHub unfortunately doesn't seem to support private/confidential issues or comments so not sure what method you'd be most comfortable with to share it.
FYI, the dump-registers
command in the CLI does something similar that I've used before to help others debug their setup.
Also, just so you're aware, I'm massively refactoring the whole thing right now – the current synchronous client is quite flaky because it is quite sensitive to timing on messages incoming and misses a lot of updates as a result. I'm nearing completion of an asyncio-based version which has been super stable so far (querying real-time values every 5s) and will be part of a native Home Assistant custom component I've been working on at the same time.
It's my inverter thats giving these errors. I've contacted you via email.
This is a hardware issue from as much as I can see – I added some workarounds which should handle this more gracefully in future.
Description
I am using the library as part of a Home Assistant integration. I've been working with someone who has a 5.0 Gen 2 inverter, and is unable to get my integration working.
The root cause appears to be in the serial number to model decoding function.
What I Did
The following script has been used to debug the issue: https://github.com/cdpuk/givenergy-local/blob/master/scripts/debug.py
We can successfully read the registers and print details with
plant.inverter_rc
, however decoding the values fails as the registers that would normally hold the serial number seem to hold other data.Patching the library such that it returns an "Unknown" model when decoding fails gets everything working. All other decoded values appear correctly. I was unable to identify another set of registers that hold the serial number in the expected format.
I have the complete output from this script, including all register values, if required.
The "Unknown" approach certainly seems most straightforward, but I appreciate there may be other reasons to
raise
instead.It's worth noting that the log messages contain the correct serial number (from the underlying modbus library?). Perhaps this would be a more reliable source for the serial number property.