Fix MODBUS connection type rtuovertcp does not connect (#52505)

* Correct host -> framer.

* Use function pointer
This commit is contained in:
jan iversen 2021-07-05 11:45:50 +02:00 committed by GitHub
parent 2e4f513526
commit 1cb298948f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import logging
from pymodbus.client.sync import ModbusSerialClient, ModbusTcpClient, ModbusUdpClient
from pymodbus.constants import Defaults
from pymodbus.exceptions import ModbusException
from pymodbus.transaction import ModbusRtuFramer
from homeassistant.const import (
CONF_DELAY,
@ -224,7 +225,7 @@ class ModbusHub:
# network configuration
self._pb_params["host"] = client_config[CONF_HOST]
if self._config_type == CONF_RTUOVERTCP:
self._pb_params["host"] = "ModbusRtuFramer"
self._pb_params["framer"] = ModbusRtuFramer
Defaults.Timeout = client_config[CONF_TIMEOUT]