Skip to content

Commit

Permalink
better algorithm for computing unique_id
Browse files Browse the repository at this point in the history
  • Loading branch information
heythisisnate committed Mar 26, 2019
1 parent c8048e1 commit ef318eb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/components/konnected/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ef318eb

Please sign in to comment.