diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 202f9694689ab5..5b3cfdc0b2baf4 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -143,7 +143,8 @@ def get_accessory(hass, state, aid, config): elif device_class == DEVICE_CLASS_ILLUMINANCE or unit in ('lm', 'lx'): a_type = 'LightSensor' - elif state.domain in ('switch', 'remote', 'input_boolean', 'script'): + elif state.domain in ('automation', 'input_boolean', 'remote', 'script', + 'switch'): a_type = 'Switch' if a_type is None: diff --git a/tests/components/homekit/test_get_accessories.py b/tests/components/homekit/test_get_accessories.py index 25a0dd3f1cb786..289c12641c3b03 100644 --- a/tests/components/homekit/test_get_accessories.py +++ b/tests/components/homekit/test_get_accessories.py @@ -109,9 +109,11 @@ def test_type_sensors(type_name, entity_id, state, attrs): @pytest.mark.parametrize('type_name, entity_id, state, attrs', [ - ('Switch', 'switch.test', 'on', {}), - ('Switch', 'remote.test', 'on', {}), + ('Switch', 'automation.test', 'on', {}), ('Switch', 'input_boolean.test', 'on', {}), + ('Switch', 'remote.test', 'on', {}), + ('Switch', 'script.test', 'on', {}), + ('Switch', 'switch.test', 'on', {}), ]) def test_type_switches(type_name, entity_id, state, attrs): """Test if switch types are associated correctly.""" diff --git a/tests/components/homekit/test_type_switches.py b/tests/components/homekit/test_type_switches.py index 5fc0b6ce1b922c..ff94c4b6a0b00f 100644 --- a/tests/components/homekit/test_type_switches.py +++ b/tests/components/homekit/test_type_switches.py @@ -9,7 +9,12 @@ @pytest.mark.parametrize('entity_id', [ - 'switch.test', 'remote.test', 'input_boolean.test']) + 'automation.test', + 'input_boolean.test', + 'remote.test', + 'script.test', + 'switch.test', +]) async def test_switch_set_state(hass, entity_id): """Test if accessory and HA are updated accordingly.""" domain = split_entity_id(entity_id)[0]