mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
parent
2bdad5388b
commit
00b9297082
@ -5,6 +5,7 @@ For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/rfxtrx/
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
import voluptuous as vol
|
||||
@ -395,6 +396,12 @@ class RfxtrxDevice(Entity):
|
||||
self._state = datas[ATTR_STATE]
|
||||
self._should_fire_event = datas[ATTR_FIREEVENT]
|
||||
self._brightness = 0
|
||||
self.added_to_hass = False
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_added_to_hass(self):
|
||||
"""Subscribe RFXtrx events."""
|
||||
self.added_to_hass = True
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
@ -429,6 +436,7 @@ class RfxtrxDevice(Entity):
|
||||
"""Update det state of the device."""
|
||||
self._state = state
|
||||
self._brightness = brightness
|
||||
if self.added_to_hass:
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _send_command(self, command, brightness=0):
|
||||
@ -469,4 +477,5 @@ class RfxtrxDevice(Entity):
|
||||
self._event.device.send_stop(self.hass.data[RFXOBJECT]
|
||||
.transport)
|
||||
|
||||
if self.added_to_hass:
|
||||
self.schedule_update_ha_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user