-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I have a box that allows me to talk to multiple (micro) inverters over a single modbus-tcp connection, but that box doesn't handle more than one TCP connection at a time.
To query all inverters using the current API, my program would need to set up an AsyncClient (using AsyncClient::new(), wait for discovery, query the inverter parameters, then close the connection, and do all again for the next inverter.
If it then wants to query the first inverter again later, it needs set up a fresh AsyncClient (making sure no other clients are active, or the gateway box will not accept the connection), which runs discovery again, etc.
I think it would be useful to have a way to switch between inverters as part of AsyncClient (tokio_modbus has context.set_slave(Slave(device_id)) for this).
This probably requires some other changes -- like a way to track what the "active device" is, and a way to store discovery data for each device on a connection.