Move dispatcher out of init. (#6355)

This commit is contained in:
Pascal Vizeli 2017-03-02 10:20:57 +01:00 committed by GitHub
parent 8743f23f13
commit 50887e7e2c
3 changed files with 14 additions and 5 deletions

View file

@ -49,10 +49,13 @@ class EnvisalinkSensor(EnvisalinkDevice, Entity):
_LOGGER.debug('Setting up sensor for partition: ' + partition_name)
super().__init__(partition_name + ' Keypad', info, controller)
@asyncio.coroutine
def async_added_to_hass(self):
"""Register callbacks."""
async_dispatcher_connect(
hass, SIGNAL_KEYPAD_UPDATE, self._update_callback)
self.hass, SIGNAL_KEYPAD_UPDATE, self._update_callback)
async_dispatcher_connect(
hass, SIGNAL_PARTITION_UPDATE, self._update_callback)
self.hass, SIGNAL_PARTITION_UPDATE, self._update_callback)
@property
def icon(self):