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,14 +63,11 @@ class WindowCovering(HomeAccessory):
return return
current_position = new_state.attributes.get(ATTR_CURRENT_POSITION) current_position = new_state.attributes.get(ATTR_CURRENT_POSITION)
if current_position is None: if isinstance(current_position, int):
return self.current_position = current_position
self.char_current_position.set_value(self.current_position)
self.current_position = int(current_position) if self.homekit_target is None or \
self.char_current_position.set_value(self.current_position) abs(self.current_position - self.homekit_target) < 6:
self.char_target_position.set_value(self.current_position)
if self.homekit_target is None or \ self.char_position_state.set_value(2)
abs(self.current_position - self.homekit_target) < 6: self.homekit_target = None
self.char_target_position.set_value(self.current_position)
self.char_position_state.set_value(2)
self.homekit_target = None

View File

@ -146,7 +146,9 @@ class Light(HomeAccessory):
hue, saturation = new_state.attributes.get( hue, saturation = new_state.attributes.get(
ATTR_HS_COLOR, (None, None)) ATTR_HS_COLOR, (None, None))
if not self._flag[RGB_COLOR] and ( 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_hue.set_value(hue, should_callback=False)
self.char_saturation.set_value(saturation, self.char_saturation.set_value(saturation,
should_callback=False) should_callback=False)