forked from home-assistant/core
Allow same IP if ports are different on modbus (#55766)
This commit is contained in:
committed by
Paulus Schoutsen
parent
eb70354ee7
commit
a6bb0eadca
@@ -242,7 +242,10 @@ def duplicate_modbus_validator(config: list) -> list:
|
|||||||
errors = []
|
errors = []
|
||||||
for index, hub in enumerate(config):
|
for index, hub in enumerate(config):
|
||||||
name = hub.get(CONF_NAME, DEFAULT_HUB)
|
name = hub.get(CONF_NAME, DEFAULT_HUB)
|
||||||
host = hub[CONF_PORT] if hub[CONF_TYPE] == SERIAL else hub[CONF_HOST]
|
if hub[CONF_TYPE] == SERIAL:
|
||||||
|
host = hub[CONF_PORT]
|
||||||
|
else:
|
||||||
|
host = f"{hub[CONF_HOST]}_{hub[CONF_PORT]}"
|
||||||
if host in hosts:
|
if host in hosts:
|
||||||
err = f"Modbus {name} contains duplicate host/port {host}, not loaded!"
|
err = f"Modbus {name} contains duplicate host/port {host}, not loaded!"
|
||||||
_LOGGER.warning(err)
|
_LOGGER.warning(err)
|
||||||
|
Reference in New Issue
Block a user