From ef318ebc15144dca01f4511409e64afc8fa2de5d Mon Sep 17 00:00:00 2001 From: Nate Clark Date: Mon, 25 Mar 2019 11:22:21 -0400 Subject: [PATCH] better algorithm for computing unique_id --- homeassistant/components/konnected/switch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/konnected/switch.py b/homeassistant/components/konnected/switch.py index dfb135e19f618b..7384d62900eec9 100644 --- a/homeassistant/components/konnected/switch.py +++ b/homeassistant/components/konnected/switch.py @@ -7,7 +7,7 @@ from . import ( CONF_ACTIVATION, CONF_MOMENTARY, CONF_PAUSE, CONF_REPEAT, - DOMAIN as KONNECTED_DOMAIN, PIN_TO_ZONE, STATE_HIGH, STATE_LOW) + DOMAIN as KONNECTED_DOMAIN, STATE_HIGH, STATE_LOW) _LOGGER = logging.getLogger(__name__) @@ -41,7 +41,8 @@ def __init__(self, device_id, pin_num, data): self._pause = self._data.get(CONF_PAUSE) self._repeat = self._data.get(CONF_REPEAT) self._state = self._boolean_state(self._data.get(ATTR_STATE)) - self._unique_id = '{}-{}'.format(device_id, PIN_TO_ZONE[pin_num]) + self._unique_id = '{}-{}'.format(device_id, hash(frozenset( + {self._pin_num, self._momentary, self._pause, self._repeat}))) self._name = self._data.get(CONF_NAME) @property