Versions
- Python: 3.10.2
- OS: Ubuntu 20.04
- Pymodbus: 3.0.0
- Modbus Hardware (if used):
Pymodbus Specific
Description
I'm trying to upgrade to 3.0.0, but run into trouble with registering my custom response class.
I do this like this:
client = AsyncModbusTcpClient(host, port, framer=ModbusSocketFramer)
client.register(PrivateHuaweiModbusResponse)
This correctly adds the response to the client.framer.decoder.__lookup table
However, upon callling client.connect(), I see that in AsyncModbusTcpClient._create_protocol, it does not pass client.framer to the ModbusClientProtocol, but instead the self.params.framer:
protocol = ModbusClientProtocol(framer=self.params.framer, **self.params.kwargs)
In the protocol-object, the framer is initialized again, without the custom response class this time.
I'm very confused about how both AsyncModbusTcpClient and ModbusClientProtocol have ModbusBaseClient as a parent class. Would it not be more appropriate to remove ModbusBaseClient as a parent class from ModbusClientProtocol and pass the client-object creating the ModbusClientProtocol to it instead?