Fix RFLink restore state (#20588)

* some minor tests refactor

* unused import

* async/await refactor

* Correct tests failures

* Restore state bug
added call to super().async_added_to_hass()

* Show brightness attribute if device supports it

* Fix light/test_rflink 

Dimmable devices defaults to 255 brightness

* delete super().device_state_attributes call
This commit is contained in:
javicalle 2019-02-10 12:50:40 +01:00 committed by Martin Hjelmare
parent 5f7f7777a0
commit 13421b326b
3 changed files with 18 additions and 1 deletions

View file

@ -185,6 +185,14 @@ class DimmableRflinkLight(SwitchableRflinkDevice, Light):
"""Return the brightness of this light between 0..255."""
return self._brightness
@property
def device_state_attributes(self):
"""Return the device state attributes."""
attr = {}
if self._brightness is not None:
attr[ATTR_BRIGHTNESS] = self._brightness
return attr
@property
def supported_features(self):
"""Flag supported features."""
@ -239,6 +247,14 @@ class HybridRflinkLight(SwitchableRflinkDevice, Light):
"""Return the brightness of this light between 0..255."""
return self._brightness
@property
def device_state_attributes(self):
"""Return the device state attributes."""
attr = {}
if self._brightness is not None:
attr[ATTR_BRIGHTNESS] = self._brightness
return attr
@property
def supported_features(self):
"""Flag supported features."""