Fixed crash during light objects initizilation (#4835)

* Fixed crash when lights objects was inited
This commit is contained in:
Stefan Jonasson 2016-12-11 09:54:50 +01:00 committed by GitHub
parent ee5b9e7291
commit 7ba25f3526

View File

@ -72,7 +72,11 @@ class TellstickLight(TellstickDevice, Light):
if brightness is not None: if brightness is not None:
self._brightness = brightness self._brightness = brightness
self._state = (self._brightness > 0) # _brightness is not defined when called from super
try:
self._state = (self._brightness > 0)
except AttributeError:
self._state = True
else: else:
self._state = False self._state = False