diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 02449607bf2..4854a828e41 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -73,8 +73,6 @@ async def async_setup(hass, config): def get_accessory(hass, state, aid, config): """Take state and return an accessory object if supported.""" - _LOGGER.debug('', - state.entity_id, aid, config) if not aid: _LOGGER.warning('The entitiy "%s" is not supported, since it ' 'generates an invalid aid, please change it.', @@ -129,8 +127,6 @@ def get_accessory(hass, state, aid, config): _LOGGER.debug('Add "%s" as "%s"', state.entity_id, 'Switch') return TYPES['Switch'](hass, state.entity_id, state.name, aid=aid) - _LOGGER.warning('The entity "%s" is not supported yet', - state.entity_id) return None diff --git a/homeassistant/components/homekit/type_covers.py b/homeassistant/components/homekit/type_covers.py index 36cfa4d635a..7616ef05fdf 100644 --- a/homeassistant/components/homekit/type_covers.py +++ b/homeassistant/components/homekit/type_covers.py @@ -46,6 +46,7 @@ class WindowCovering(HomeAccessory): def move_cover(self, value): """Move cover to value if call came from HomeKit.""" + self.char_target_position.set_value(value, should_callback=False) if value != self.current_position: _LOGGER.debug('%s: Set position to %d', self._entity_id, value) self.homekit_target = value diff --git a/homeassistant/components/homekit/type_lights.py b/homeassistant/components/homekit/type_lights.py index c723fcc08a6..2415bb1a4df 100644 --- a/homeassistant/components/homekit/type_lights.py +++ b/homeassistant/components/homekit/type_lights.py @@ -71,6 +71,7 @@ class Light(HomeAccessory): _LOGGER.debug('%s: Set state to %d', self._entity_id, value) self._flag[CHAR_ON] = True + self.char_on.set_value(value, should_callback=False) if value == 1: self._hass.components.light.turn_on(self._entity_id) @@ -81,6 +82,7 @@ class Light(HomeAccessory): """Set brightness if call came from HomeKit.""" _LOGGER.debug('%s: Set brightness to %d', self._entity_id, value) self._flag[CHAR_BRIGHTNESS] = True + self.char_brightness.set_value(value, should_callback=False) self._hass.components.light.turn_on( self._entity_id, brightness_pct=value) @@ -88,6 +90,7 @@ class Light(HomeAccessory): """Set saturation if call came from HomeKit.""" _LOGGER.debug('%s: Set saturation to %d', self._entity_id, value) self._flag[CHAR_SATURATION] = True + self.char_saturation.set_value(value, should_callback=False) self._saturation = value self.set_color() @@ -95,6 +98,7 @@ class Light(HomeAccessory): """Set hue if call came from HomeKit.""" _LOGGER.debug('%s: Set hue to %d', self._entity_id, value) self._flag[CHAR_HUE] = True + self.char_hue.set_value(value, should_callback=False) self._hue = value self.set_color() diff --git a/homeassistant/components/homekit/type_security_systems.py b/homeassistant/components/homekit/type_security_systems.py index 1d47160f9d2..146fca95b53 100644 --- a/homeassistant/components/homekit/type_security_systems.py +++ b/homeassistant/components/homekit/type_security_systems.py @@ -54,6 +54,7 @@ class SecuritySystem(HomeAccessory): _LOGGER.debug('%s: Set security state to %d', self._entity_id, value) self.flag_target_state = True + self.char_target_state.set_value(value, should_callback=False) hass_value = HOMEKIT_TO_HASS[value] service = STATE_TO_SERVICE[hass_value] diff --git a/homeassistant/components/homekit/type_switches.py b/homeassistant/components/homekit/type_switches.py index fd3291ffe23..1f19893d0be 100644 --- a/homeassistant/components/homekit/type_switches.py +++ b/homeassistant/components/homekit/type_switches.py @@ -36,6 +36,7 @@ class Switch(HomeAccessory): _LOGGER.debug('%s: Set switch state to %s', self._entity_id, value) self.flag_target_state = True + self.char_on.set_value(value, should_callback=False) service = SERVICE_TURN_ON if value else SERVICE_TURN_OFF self._hass.services.call(self._domain, service, {ATTR_ENTITY_ID: self._entity_id}) diff --git a/homeassistant/components/homekit/type_thermostats.py b/homeassistant/components/homekit/type_thermostats.py index b73b492ba74..3f545e90eb3 100644 --- a/homeassistant/components/homekit/type_thermostats.py +++ b/homeassistant/components/homekit/type_thermostats.py @@ -97,6 +97,7 @@ class Thermostat(HomeAccessory): def set_heat_cool(self, value): """Move operation mode to value if call came from HomeKit.""" + self.char_target_heat_cool.set_value(value, should_callback=False) if value in HC_HOMEKIT_TO_HASS: _LOGGER.debug('%s: Set heat-cool to %d', self._entity_id, value) self.heat_cool_flag_target_state = True @@ -109,6 +110,7 @@ class Thermostat(HomeAccessory): _LOGGER.debug('%s: Set cooling threshold temperature to %.2f', self._entity_id, value) self.coolingthresh_flag_target_state = True + self.char_cooling_thresh_temp.set_value(value, should_callback=False) low = self.char_heating_thresh_temp.value self._hass.components.climate.set_temperature( entity_id=self._entity_id, target_temp_high=value, @@ -119,6 +121,7 @@ class Thermostat(HomeAccessory): _LOGGER.debug('%s: Set heating threshold temperature to %.2f', self._entity_id, value) self.heatingthresh_flag_target_state = True + self.char_heating_thresh_temp.set_value(value, should_callback=False) # Home assistant always wants to set low and high at the same time high = self.char_cooling_thresh_temp.value self._hass.components.climate.set_temperature( @@ -130,6 +133,7 @@ class Thermostat(HomeAccessory): _LOGGER.debug('%s: Set target temperature to %.2f', self._entity_id, value) self.temperature_flag_target_state = True + self.char_target_temp.set_value(value, should_callback=False) self._hass.components.climate.set_temperature( temperature=value, entity_id=self._entity_id) diff --git a/tests/components/homekit/test_get_accessories.py b/tests/components/homekit/test_get_accessories.py index e6dbe1ff729..ee7baae2755 100644 --- a/tests/components/homekit/test_get_accessories.py +++ b/tests/components/homekit/test_get_accessories.py @@ -16,17 +16,6 @@ _LOGGER = logging.getLogger(__name__) CONFIG = {} -def test_get_accessory_invalid(caplog): - """Test with unsupported component.""" - assert get_accessory(None, State('test.unsupported', 'on'), 2, None) \ - is None - assert caplog.records[1].levelname == 'WARNING' - - assert get_accessory(None, State('test.test', 'on'), None, None) \ - is None - assert caplog.records[3].levelname == 'WARNING' - - class TestGetAccessories(unittest.TestCase): """Methods to test the get_accessory method."""