cdpuk / givenergy-local

Home Assistant integration for local access to GivEnergy inverter and battery systems
MIT License
52 stars 14 forks source link

Unable to connect to inverter - Failed to validate inverter configuration #60

Closed jon-riches closed 1 year ago

jon-riches commented 1 year ago

Hi

Thanks for your work on this.

I have a recently installed Gen 3 Inverter, can successfully connect via Britkat's giv-tcp, tried this as an alternative that may suit my needs better, however cannot get it to connect. I saw the other similar issue, but note that it's a different serial, and the other integration works ok for me.

HA Version 2023.7.2 HACS 1.32.1 GivEnergy Local v 1.8.1

Kind regards

Jonathan

Logger: custom_components.givenergy_local
Source: custom_components/givenergy_local/config_flow.py:27
Integration: givenergy_local ([documentation](https://github.com/cdpuk/givenergy-local), [issues](https://github.com/cdpuk/givenergy-local/issues))
First occurred: 17:35:56 (1 occurrences)
Last logged: 17:35:56

Failed to validate inverter configuration
Traceback (most recent call last):
  File "/config/custom_components/givenergy_local/config_flow.py", line 48, in async_step_user
    serial_no = await read_inverter_serial(self.hass, user_input)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/givenergy_local/config_flow.py", line 27, in read_inverter_serial
    serial_no: str = plant.inverter.inverter_serial_number
                     ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/givenergy_modbus/model/plant.py", line 32, in inverter
    return Inverter.from_orm(self.inverter_rc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/main.py", line 577, in pydantic.main.BaseModel.from_orm
  File "pydantic/main.py", line 1102, in pydantic.main.validate_model
  File "/usr/local/lib/python3.11/site-packages/givenergy_modbus/model/inverter.py", line 212, in compute_model
    values['inverter_model'] = Model.from_serial_number(values['inverter_serial_number'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/givenergy_modbus/model/inverter.py", line 39, in from_serial_number
    raise UnknownModelError(f"Cannot determine model number from serial number {serial_number}")
givenergy_modbus.model.inverter.UnknownModelError: Cannot determine model number from serial number FD2311G912
cdpuk commented 1 year ago

The root cause is a common one that I've now recorded in #61. giv-tcp has taken this approach, which is why it's working for you. I'll close this one and point any more related issues to #61.