WillCodeForCats / solaredge-modbus-multi

Home Assistant integration for SolarEdge inverters with Modbus/TCP. For single or multiple inverters, meters, and batteries.
Apache License 2.0
160 stars 16 forks source link

Support for non-sequential inverter device-ids #526

Open mtbsteve opened 5 months ago

mtbsteve commented 5 months ago

Describe the bug

I do have a setup of 2 inverters, a SE battery and the SE Backup interface. The primary inverter, a SE-10K-RWB48 has the device id 1. The second inverter, a SE-5K, which is connected as as a slave, has the device id 9. I tried all possible configuration entries, but this integration only finds the RWB48 inverter along with the battery and the meter, but not the slave inverter. The device ids were set by the installer company and I dont want to change them. Is there a way how I can run all inverters with this integration?

Expected behavior

When entering the number of inverters and starting device id in the config menu, all connected devices should be found.

Screenshots

No response

Diagnostic File

--

Debug logs

No response

Home Assistant Version

2024.1.6

solaredge-modbus-multi Version

2.4.9

Installation Type

Core

Read the Instructions

Additional Context

No response

deqw commented 5 months ago

You say your configuration follows https://github.com/WillCodeForCats/solaredge-modbus-multi/wiki/Configuration

But there it says: Important: If you have more than one inverter, the inverters must have sequential unit IDs (i.e. 1, 2, 3, ...).

Edit: typo

WillCodeForCats commented 5 months ago

The device ids were set by the installer company and I dont want to change them.

If you don't want to use a compatible config for right now, then you'll need to wait then until some future version allows non-sequential inverter IDs.

mtbsteve commented 5 months ago

@WillCodeForCats non-sequential device ids is a valid Solaredge configuration. As long as my installation is under warranty, I cannot make changes to the setup w/o the risk of loosing warranty coverage from my installer. I hope you can understand this and I would really appreciate if this can be fixed. Thx.

WillCodeForCats commented 5 months ago

Non sequential ID support is already on the project idea list, but there is no timeline for it.

mtbsteve commented 5 months ago

Non sequential ID support is already on the project idea list, but there is no timeline for it.

Appreciated :+1:

mtbsteve commented 5 months ago

A quick and dirty hack to support inverters with non-sequential IDs as interim fix in the file hub.py line 205ff. A better solution could be to input a comma-separated list of inverter ids in the config menu instead of number_of_inverters and then work down the list in the async_init_solaredge routine.

for inverter_index in range(self._number_of_inverters):                                                                               
    # quick hack with hardcoded ids to enable non-sequential inverter device ids                                                          
    if (inverter_index == 0):                                                                                                         
        inverter_unit_id = 1     # add inverter 1 with device id 1                                                                                                    
    elif (inverter_index == 1):                                                                                                       
        inverter_unit_id = 9    # add inverter 2 with device id 9                                                                                                      
    #    inverter_unit_id = inverter_index + self._start_device_id                                                                        
WillCodeForCats commented 5 months ago

Yes I already have a solution, it's just not uploaded.

WillCodeForCats commented 5 months ago

It will be part of #460 but there are other enhancements I want to get released first. Changing how it handles inverter IDs is is not backwards compatible, so once existing users upgrade it will force a config schema migration internally where they won't be able to downgrade to a previous version. This will be in the 2.5.x releases, it won't be part of the current 2.4.x line.

Menz01 commented 3 months ago

It will be part of #460 but there are other enhancements I want to get released first. Changing how it handles inverter IDs is is not backwards compatible, so once existing users upgrade it will force a config schema migration internally where they won't be able to downgrade to a previous version. This will be in the 2.5.x releases, it won't be part of the current 2.4.x line.

Has this been implemented? I have 2 inverters and I could never get this to find my second inverter so I was thinking it may not be a sequential id?

Menz01 commented 1 week ago

A quick and dirty hack to support inverters with non-sequential IDs as interim fix in the file hub.py line 205ff. A better solution could be to input a comma-separated list of inverter ids in the config menu instead of number_of_inverters and then work down the list in the async_init_solaredge routine.

for inverter_index in range(self._number_of_inverters):                                                                               
    # quick hack with hardcoded ids to enable non-sequential inverter device ids                                                          
    if (inverter_index == 0):                                                                                                         
        inverter_unit_id = 1     # add inverter 1 with device id 1                                                                                                    
    elif (inverter_index == 1):                                                                                                       
        inverter_unit_id = 9    # add inverter 2 with device id 9                                                                                                      
    #    inverter_unit_id = inverter_index + self._start_device_id                                                                        

does this still work? i think i am having the same issue... i have 2 inverters and it fails whenever i set the integration to 2

Menz01 commented 1 day ago

@WillCodeForCats Hello... i was just curious if this is still on your radar to do?

WillCodeForCats commented 1 day ago

Yes, I've made a few iterations but wasn't happy with them or how the code looked.

Progress is in #604 and the branch.