Allow same address different register types in modbus (#55767)

pull/55870/head
jan iversen 2021-09-06 22:35:40 +02:00 committed by Paulus Schoutsen
parent a6bb0eadca
commit 823fd60991
1 changed files with 6 additions and 0 deletions

View File

@ -25,9 +25,11 @@ from homeassistant.const import (
from .const import (
CONF_DATA_TYPE,
CONF_INPUT_TYPE,
CONF_SWAP,
CONF_SWAP_BYTE,
CONF_SWAP_NONE,
CONF_WRITE_TYPE,
DATA_TYPE_CUSTOM,
DATA_TYPE_FLOAT,
DATA_TYPE_FLOAT16,
@ -212,6 +214,10 @@ def duplicate_entity_validator(config: dict) -> dict:
for index, entry in enumerate(hub[conf_key]):
name = entry[CONF_NAME]
addr = str(entry[CONF_ADDRESS])
if CONF_INPUT_TYPE in entry:
addr += "_" + str(entry[CONF_INPUT_TYPE])
elif CONF_WRITE_TYPE in entry:
addr += "_" + str(entry[CONF_WRITE_TYPE])
if CONF_COMMAND_ON in entry:
addr += "_" + str(entry[CONF_COMMAND_ON])
if CONF_COMMAND_OFF in entry: