From ae4e792651d72ab6f629757e7b1c66219c4e3599 Mon Sep 17 00:00:00 2001 From: cdce8p <30130371+cdce8p@users.noreply.github.com> Date: Mon, 9 Apr 2018 22:57:10 +0200 Subject: [PATCH] Improved upgradeability HomeKit security_systems (#13783) --- .../homekit/type_security_systems.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/homekit/type_security_systems.py b/homeassistant/components/homekit/type_security_systems.py index 235a8b22e7c..0c3c3e42d4b 100644 --- a/homeassistant/components/homekit/type_security_systems.py +++ b/homeassistant/components/homekit/type_security_systems.py @@ -67,15 +67,13 @@ class SecuritySystem(HomeAccessory): return hass_state = new_state.state - if hass_state not in HASS_TO_HOMEKIT: - return + if hass_state in HASS_TO_HOMEKIT: + current_security_state = HASS_TO_HOMEKIT[hass_state] + self.char_current_state.set_value(current_security_state) + _LOGGER.debug('%s: Updated current state to %s (%d)', + self.entity_id, hass_state, current_security_state) - current_security_state = HASS_TO_HOMEKIT[hass_state] - self.char_current_state.set_value(current_security_state) - _LOGGER.debug('%s: Updated current state to %s (%d)', - self.entity_id, hass_state, current_security_state) - - if not self.flag_target_state: - self.char_target_state.set_value(current_security_state) - if self.char_target_state.value == self.char_current_state.value: - self.flag_target_state = False + if not self.flag_target_state: + self.char_target_state.set_value(current_security_state) + if self.char_target_state.value == self.char_current_state.value: + self.flag_target_state = False