Add temporary fix to modbus to solve upstream problem (#53857)

This commit is contained in:
jan iversen 2021-08-05 02:03:31 +02:00 committed by GitHub
parent a8e4482594
commit b2fffdd13e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,7 +60,11 @@ class BasePlatform(Entity):
def __init__(self, hub: ModbusHub, entry: dict[str, Any]) -> None:
"""Initialize the Modbus binary sensor."""
self._hub = hub
self._slave = entry.get(CONF_SLAVE)
# temporary fix,
# make sure slave is always defined to avoid an error in pymodbus
# attr(in_waiting) not defined.
# see issue #657 and PR #660 in riptideio/pymodbus
self._slave = entry.get(CONF_SLAVE, 0)
self._address = int(entry[CONF_ADDRESS])
self._input_type = entry[CONF_INPUT_TYPE]
self._value = None