Fix modbus switch "old style" config problem (#49352)
Fix that using CONF_HUB in switch, changed the hub for all subsequent switches.
This commit is contained in:
parent
a5806b59f2
commit
8acc3f0b03
3 changed files with 9 additions and 6 deletions
|
@ -89,10 +89,11 @@ async def async_setup_platform(
|
|||
for entry in discovery_info[CONF_BINARY_SENSORS]:
|
||||
if CONF_HUB in entry:
|
||||
# from old config!
|
||||
discovery_info[CONF_NAME] = entry[CONF_HUB]
|
||||
hub: ModbusHub = hass.data[MODBUS_DOMAIN][entry[CONF_HUB]]
|
||||
else:
|
||||
hub: ModbusHub = hass.data[MODBUS_DOMAIN][discovery_info[CONF_NAME]]
|
||||
if CONF_SCAN_INTERVAL not in entry:
|
||||
entry[CONF_SCAN_INTERVAL] = DEFAULT_SCAN_INTERVAL
|
||||
hub: ModbusHub = hass.data[MODBUS_DOMAIN][discovery_info[CONF_NAME]]
|
||||
sensors.append(
|
||||
ModbusBinarySensor(
|
||||
hub,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue