Bugfixes HomeKit covers, lights (#13689)

* covers -> current_position attribute
* lights -> hue and saturation attribute
This commit is contained in:
cdce8p 2018-04-05 00:46:27 +02:00 committed by GitHub
parent 301077ded9
commit f263a931f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View File

@ -63,12 +63,9 @@ class WindowCovering(HomeAccessory):
return
current_position = new_state.attributes.get(ATTR_CURRENT_POSITION)
if current_position is None:
return
self.current_position = int(current_position)
if isinstance(current_position, int):
self.current_position = current_position
self.char_current_position.set_value(self.current_position)
if self.homekit_target is None or \
abs(self.current_position - self.homekit_target) < 6:
self.char_target_position.set_value(self.current_position)

View File

@ -146,7 +146,9 @@ class Light(HomeAccessory):
hue, saturation = new_state.attributes.get(
ATTR_HS_COLOR, (None, None))
if not self._flag[RGB_COLOR] and (
hue != self._hue or saturation != self._saturation):
hue != self._hue or saturation != self._saturation) and \
isinstance(hue, (int, float)) and \
isinstance(saturation, (int, float)):
self.char_hue.set_value(hue, should_callback=False)
self.char_saturation.set_value(saturation,
should_callback=False)