Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for non-sequential modbus device ID numbers #636

Merged
merged 36 commits into from
Aug 28, 2024

Conversation

WillCodeForCats
Copy link
Owner

@WillCodeForCats WillCodeForCats commented Jul 25, 2024

This PR adds support for non-sequential device ID numbers as a list of Modbus/TCP IDs.

List: 1,2,3,4 or 1,3,10
Range: 1-4 becomes 1,2,3,4
Combination: 1-3,5,10 becomes 1,2,3,5,10

Existing configurations will be automatically update by Home Assistant using config migration into a list.

Uses code contributed by @thargy for parsing and validating the ID list format.

@WillCodeForCats WillCodeForCats added the enhancement New feature or request label Jul 25, 2024
@WillCodeForCats WillCodeForCats self-assigned this Jul 25, 2024
@WillCodeForCats WillCodeForCats changed the title Allow non-sequential modbus device ID numbers Support for non-sequential modbus device ID numbers Jul 25, 2024
@WillCodeForCats
Copy link
Owner Author

This feature will be backwards incompatible: the integration to fail setup if the user downgrades without restoring their Home Assistant configuration from backup.

Config is backwards incompatible with 2.x.x releases.
@rzulian
Copy link

rzulian commented Aug 19, 2024

@WillCodeForCats When are you planning to release this version? I would love to switch to this component but I need the non sequential IDs feature in place

@WillCodeForCats
Copy link
Owner Author

There will be a pre-release soon.

@WillCodeForCats
Copy link
Owner Author

Release v3.0.0-pre.1 is now available for testing.

@WillCodeForCats
Copy link
Owner Author

@rzulian Can you test the pre-release?

@thargy
Copy link
Contributor

thargy commented Aug 28, 2024

@rzulian Can you test the pre-release?

It's been working for me for the last few days, but I haven't tried non-sequential IDs with it.

@rzulian
Copy link

rzulian commented Aug 28, 2024

I'm going to try it right now!

@rzulian
Copy link

rzulian commented Aug 28, 2024

Nope, I'm getting an error " [Input/Output] ERROR: No response received after 3 retries"

2024-08-28 18:28:01.401 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Retry limit=5 time=800 ratio=3
2024-08-28 18:28:01.402 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] New AsyncModbusTcpClient: reconnect_delay=0 reconnect_delay_max=3 timeout=3
2024-08-28 18:28:01.403 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Connecting to 192.168.1.6:502 ...
2024-08-28 18:28:01.430 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] coordinator timeout is 31.2
2024-08-28 18:28:01.431 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for inverter at 192.168.1.6 ID 1
2024-08-28 18:28:01.460 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 69 69
2024-08-28 18:28:01.461 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_ID 0x53756e53<class 'int'>
2024-08-28 18:28:01.461 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_DID 0x1<class 'int'>
2024-08-28 18:28:01.463 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_Length 0x41<class 'int'>
2024-08-28 18:28:01.463 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Manufacturer SolarEdge<class 'str'>
2024-08-28 18:28:01.463 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Model SE3500<class 'str'>
2024-08-28 18:28:01.463 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Option <class 'str'>
2024-08-28 18:28:01.463 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Version 0003.2724<class 'str'>
2024-08-28 18:28:01.463 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SerialNumber BA07F9C4<class 'str'>
2024-08-28 18:28:01.464 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Device_address 0x1<class 'int'>
2024-08-28 18:28:01.485 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 9 9
2024-08-28 18:28:01.486 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_DID 0x1 <class 'int'>
2024-08-28 18:28:01.486 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_Length 0x41 <class 'int'>
2024-08-28 18:28:01.488 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_Units 0x0 <class 'int'>
2024-08-28 18:28:01.488 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 is NOT Multiple MPPT
2024-08-28 18:28:01.488 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M1
2024-08-28 18:28:01.537 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 67 67
2024-08-28 18:28:01.537 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SunSpec_DID 0x1 <class 'int'>
2024-08-28 18:28:01.537 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SunSpec_Length 0x41 <class 'int'>
2024-08-28 18:28:01.537 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Manufacturer WattNode <class 'str'>
2024-08-28 18:28:01.537 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Model WNC-3Y-400-MB <class 'str'>
2024-08-28 18:28:01.538 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Option Export+Import <class 'str'>
2024-08-28 18:28:01.538 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Version 24 <class 'str'>
2024-08-28 18:28:01.538 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SerialNumber 4009193 <class 'str'>
2024-08-28 18:28:01.538 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Device_address 0x2 <class 'int'>
2024-08-28 18:28:01.538 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Found I1M1
2024-08-28 18:28:01.538 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M2
2024-08-28 18:28:01.565 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Unit 1: Exception Response(131, 3, IllegalAddress)
2024-08-28 18:28:01.566 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M2: Meter 2: unsupported address
2024-08-28 18:28:01.567 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M3
2024-08-28 18:28:01.577 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Unit 1: Exception Response(131, 3, IllegalAddress)
2024-08-28 18:28:01.578 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M3: Meter 3: unsupported address
2024-08-28 18:28:01.578 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for battery I1B1
2024-08-28 18:28:01.615 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 68 68
2024-08-28 18:28:01.616 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Manufacturer LG���1906141123 <class 'str'>
2024-08-28 18:28:01.616 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Model R15563P3SSEG11906141123 <class 'str'>
2024-08-28 18:28:01.616 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Version DCDC 7.5.6 BMS 2.0.5.0 <class 'str'>
2024-08-28 18:28:01.616 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_SerialNumber 1906141123 <class 'str'>
2024-08-28 18:28:01.616 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_Device_Address 0xf <class 'int'>
2024-08-28 18:28:01.616 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B1: B_RatedEnergy 0x46192000 <class 'float'>
2024-08-28 18:28:01.617 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Found I1B1
2024-08-28 18:28:01.617 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for battery I1B2
2024-08-28 18:28:01.668 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 68 68
2024-08-28 18:28:01.669 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B2: B_Manufacturer � <class 'str'>
2024-08-28 18:28:01.669 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B2: B_Model <class 'str'>
2024-08-28 18:28:01.669 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B2: B_Version <class 'str'>
2024-08-28 18:28:01.670 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B2: B_SerialNumber <class 'str'>
2024-08-28 18:28:01.670 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B2: B_Device_Address 0xe <class 'int'>
2024-08-28 18:28:01.670 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B2: B_RatedEnergy 0xff7fffff <class 'float'>
2024-08-28 18:28:01.670 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B2: Battery 2 not usable (rating <=0)
2024-08-28 18:28:01.670 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for battery I1B3
2024-08-28 18:28:01.696 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Unit 1: Exception Response(131, 3, IllegalAddress)
2024-08-28 18:28:01.698 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1B3: Battery 3 unsupported address
2024-08-28 18:28:01.698 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for inverter at 192.168.1.6 ID 3
2024-08-28 18:28:13.718 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Disconnectng from 192.168.1.6:502 (clear_client=False).
2024-08-28 18:28:13.720 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Finished fetching SolarEdge Coordinator data in 12.319 seconds (success: False)
2024-08-28 18:28:19.111 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] solaredge_modbus_multi configuration: inverter_list=[1, 3], detect_meters=True, detect_batteries=False, detect_extras=True, keep_modbus_open=False, adv_storage_control=False, adv_site_limit_control=False, allow_battery_energy_reset=False, sleep_after_write=0, battery_rating_adjust=0,
2024-08-28 18:28:19.112 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Retry limit=5 time=800 ratio=3
2024-08-28 18:28:19.112 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] New AsyncModbusTcpClient: reconnect_delay=0 reconnect_delay_max=3 timeout=3
2024-08-28 18:28:19.112 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Connecting to 192.168.1.6:502 ...
2024-08-28 18:28:19.121 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] coordinator timeout is 31.2
2024-08-28 18:28:19.123 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for inverter at 192.168.1.6 ID 1
2024-08-28 18:28:19.235 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 69 69
2024-08-28 18:28:19.235 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_ID 0x53756e53<class 'int'>
2024-08-28 18:28:19.235 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_DID 0x1<class 'int'>
2024-08-28 18:28:19.235 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_Length 0x41<class 'int'>
2024-08-28 18:28:19.235 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Manufacturer SolarEdge<class 'str'>
2024-08-28 18:28:19.236 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Model SE3500<class 'str'>
2024-08-28 18:28:19.236 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Option <class 'str'>
2024-08-28 18:28:19.236 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Version 0003.2724<class 'str'>
2024-08-28 18:28:19.236 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SerialNumber BA07F9C4<class 'str'>
2024-08-28 18:28:19.236 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Device_address 0x1<class 'int'>
2024-08-28 18:28:19.272 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 9 9
2024-08-28 18:28:19.273 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_DID 0x1 <class 'int'>
2024-08-28 18:28:19.274 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_Length 0x41 <class 'int'>
2024-08-28 18:28:19.275 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_Units 0x0 <class 'int'>
2024-08-28 18:28:19.275 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 is NOT Multiple MPPT
2024-08-28 18:28:19.275 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M1
2024-08-28 18:28:19.323 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 67 67
2024-08-28 18:28:19.323 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SunSpec_DID 0x1 <class 'int'>
2024-08-28 18:28:19.323 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SunSpec_Length 0x41 <class 'int'>
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Manufacturer WattNode <class 'str'>
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Model WNC-3Y-400-MB <class 'str'>
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Option Export+Import <class 'str'>
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Version 24 <class 'str'>
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SerialNumber 4009193 <class 'str'>
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Device_address 0x2 <class 'int'>
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Found I1M1
2024-08-28 18:28:19.324 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M2
2024-08-28 18:28:19.349 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Unit 1: Exception Response(131, 3, IllegalAddress)
2024-08-28 18:28:19.351 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M2: Meter 2: unsupported address
2024-08-28 18:28:19.352 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M3
2024-08-28 18:28:19.396 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Unit 1: Exception Response(131, 3, IllegalAddress)
2024-08-28 18:28:19.396 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M3: Meter 3: unsupported address
2024-08-28 18:28:19.397 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for inverter at 192.168.1.6 ID 3
2024-08-28 18:28:31.407 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Disconnectng from 192.168.1.6:502 (clear_client=False).
2024-08-28 18:28:31.407 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Finished fetching SolarEdge Coordinator data in 12.296 seconds (success: False)
2024-08-28 18:28:41.511 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] solaredge_modbus_multi configuration: inverter_list=[1, 3], detect_meters=True, detect_batteries=False, detect_extras=True, keep_modbus_open=False, adv_storage_control=False, adv_site_limit_control=False, allow_battery_energy_reset=False, sleep_after_write=0, battery_rating_adjust=0,
2024-08-28 18:28:41.512 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Retry limit=5 time=800 ratio=3
2024-08-28 18:28:41.512 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] New AsyncModbusTcpClient: reconnect_delay=0 reconnect_delay_max=3 timeout=3
2024-08-28 18:28:41.513 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Connecting to 192.168.1.6:502 ...
2024-08-28 18:28:41.531 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] coordinator timeout is 31.2
2024-08-28 18:28:41.531 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for inverter at 192.168.1.6 ID 1
2024-08-28 18:28:41.656 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 69 69
2024-08-28 18:28:41.656 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_ID 0x53756e53<class 'int'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_DID 0x1<class 'int'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SunSpec_Length 0x41<class 'int'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Manufacturer SolarEdge<class 'str'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Model SE3500<class 'str'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Option <class 'str'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Version 0003.2724<class 'str'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_SerialNumber BA07F9C4<class 'str'>
2024-08-28 18:28:41.657 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1: C_Device_address 0x1<class 'int'>
2024-08-28 18:28:41.685 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 9 9
2024-08-28 18:28:41.685 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_DID 0x1 <class 'int'>
2024-08-28 18:28:41.688 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_Length 0x41 <class 'int'>
2024-08-28 18:28:41.688 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 MMPPT: mmppt_Units 0x0 <class 'int'>
2024-08-28 18:28:41.688 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1 is NOT Multiple MPPT
2024-08-28 18:28:41.688 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M1
2024-08-28 18:28:41.747 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Registers received requested : 67 67
2024-08-28 18:28:41.747 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SunSpec_DID 0x1 <class 'int'>
2024-08-28 18:28:41.747 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SunSpec_Length 0x41 <class 'int'>
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Manufacturer WattNode <class 'str'>
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Model WNC-3Y-400-MB <class 'str'>
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Option Export+Import <class 'str'>
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Version 24 <class 'str'>
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_SerialNumber 4009193 <class 'str'>
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M1: C_Device_address 0x2 <class 'int'>
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Found I1M1
2024-08-28 18:28:41.748 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M2
2024-08-28 18:28:41.784 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Unit 1: Exception Response(131, 3, IllegalAddress)
2024-08-28 18:28:41.784 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M2: Meter 2: unsupported address
2024-08-28 18:28:41.784 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for meter I1M3
2024-08-28 18:28:41.798 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Unit 1: Exception Response(131, 3, IllegalAddress)
2024-08-28 18:28:41.799 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] I1M3: Meter 3: unsupported address
2024-08-28 18:28:41.799 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for inverter at 192.168.1.6 ID 3
2024-08-28 18:28:53.815 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Disconnectng from 192.168.1.6:502 (clear_client=False).
2024-08-28 18:28:53.816 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Finished fetching SolarEdge Coordinator data in 12.304 seconds (success: False)```

@WillCodeForCats
Copy link
Owner Author

It is looking for an inverter at ID 3, but that message means there was no response from that ID. Perhaps second inverter is at a different address?

@rzulian
Copy link

rzulian commented Aug 28, 2024 via email

@WillCodeForCats
Copy link
Owner Author

If they're at different IP addresses you would just add two hubs, one for each IP address.

@rzulian
Copy link

rzulian commented Aug 28, 2024

I can try, but using the component "solaredge modbus" with the modification to support multiple inverters, I was using only the first invert IP address

@rzulian
Copy link

rzulian commented Aug 28, 2024

First inverter is working fine, but the second added as a new hub is not

2024-08-28 18:58:45.898 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Disconnectng from 192.168.1.8:502 (clear_client=False).
2024-08-28 18:58:56.115 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] solaredge_modbus_multi configuration: inverter_list=[3], detect_meters=True, detect_batteries=False, detect_extras=True, keep_modbus_open=False, adv_storage_control=False, adv_site_limit_control=False, allow_battery_energy_reset=False, sleep_after_write=0, battery_rating_adjust=0,
2024-08-28 18:58:56.115 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Retry limit=5 time=800 ratio=3
2024-08-28 18:58:56.115 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] New AsyncModbusTcpClient: reconnect_delay=0 reconnect_delay_max=3 timeout=3
2024-08-28 18:58:56.116 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Connecting to 192.168.1.8:502 ...
2024-08-28 18:58:56.136 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] coordinator timeout is 21.6
2024-08-28 18:58:56.137 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Looking for inverter at 192.168.1.8 ID 3
2024-08-28 18:59:09.203 DEBUG (MainThread) [custom_components.solaredge_modbus_multi.hub] Disconnectng from 192.168.1.8:502 (clear_client=False).
2024-08-28 18:59:09.203 DEBUG (MainThread) [custom_components.solaredge_modbus_multi] Finished fetching SolarEdge Coordinator data in 13.088 seconds (success: False)

It has been a long time ago, but if I remember correctly, the second inverter is accessible from the data in the inverter1 registry

@WillCodeForCats
Copy link
Owner Author

Look at web setapp on your inverters and see what the Unit ID is set to on each of them.

https://github.com/WillCodeForCats/solaredge-modbus-multi/wiki/Configuration#inverter-configuration

Otherwise just try ID 1 on both IP addresses.

@rzulian
Copy link

rzulian commented Aug 28, 2024 via email

@rzulian
Copy link

rzulian commented Aug 28, 2024

BTW, this was my pull request with some technical detail about my case and the support for multiple inverters
erikarenhill/solaredge-modbus-hass#29

@WillCodeForCats
Copy link
Owner Author

There must be something unique about your configuration that I don't understand, because I don't see a reason why it shouldn't work.

@WillCodeForCats
Copy link
Owner Author

BTW, this was my pull request with some technical detail about my case and the support for multiple inverters erikarenhill/solaredge-modbus-hass#29

I see that adds a configurable unit_id to the code, which is the exact same thing I'm doing here.

The only difference this PR makes is allowing a list of IDs to be configured in the HA front end instead of generating IDs internally with a loop counter.

@WillCodeForCats
Copy link
Owner Author

Also try turning off the option "Auto-Detect Additional Entities" because that causes some inverters to hang: see PR #653

@rzulian
Copy link

rzulian commented Aug 28, 2024

From the comment in the PR is see that I had to use the TcpModbusClient. https://github.com/erikarenhill/solaredge-modbus-hass/pull/29/files
Does this resonate to you?

@WillCodeForCats
Copy link
Owner Author

From the comment in the PR is see that I had to use the TcpModbusClient. https://github.com/erikarenhill/solaredge-modbus-hass/pull/29/files Does this resonate to you?

My integration is using pymodbus, it always has from the first version.

@rzulian
Copy link

rzulian commented Aug 28, 2024

Could you please check the code in this old PR and see if there is something that can be missing in your code. I remember I had to invest a lot of time to let it work, but it was 2021 :(

@WillCodeForCats
Copy link
Owner Author

I went and changed my working system from Device IDs1,2 to use 1,3 in SetApp and it works fine for me.

Here's my diagnostic file as proof:

config_entry-solaredge_modbus_multi-e3b4ad891a831bb72b37a1247705753f.json

@WillCodeForCats
Copy link
Owner Author

Could you please check the code in this old PR and see if there is something that can be missing in your code. I remember I had to invest a lot of time to let it work, but it was 2021 :(

I really do not see any reason why it shouldn't work. I've supported multiple inverters since the first release, this PR only changes how the list of Device IDs is defined. I created my integration specifically for multiple inverter support and many people use it successfully.

Also make sure to disable or remove other integrations that would poll the inverter when you try to use this one. This might also require restarting Home Assistant to resolve library requirements.

@WillCodeForCats
Copy link
Owner Author

Merging since there are enough success reports from the first pre-release.

@WillCodeForCats WillCodeForCats merged commit b7f731b into main Aug 28, 2024
8 checks passed
@rzulian
Copy link

rzulian commented Aug 28, 2024

It's working! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants