mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add HomeKit support for automations (#14595)
This commit is contained in:
parent
a9f19a16ee
commit
143be49c66
@ -149,7 +149,8 @@ def get_accessory(hass, state, aid, config):
|
|||||||
elif device_class == DEVICE_CLASS_ILLUMINANCE or unit in ('lm', 'lx'):
|
elif device_class == DEVICE_CLASS_ILLUMINANCE or unit in ('lm', 'lx'):
|
||||||
a_type = 'LightSensor'
|
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'
|
a_type = 'Switch'
|
||||||
|
|
||||||
if a_type is None:
|
if a_type is None:
|
||||||
|
@ -129,9 +129,11 @@ def test_type_sensors(type_name, entity_id, state, attrs):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('type_name, entity_id, state, attrs', [
|
@pytest.mark.parametrize('type_name, entity_id, state, attrs', [
|
||||||
('Switch', 'switch.test', 'on', {}),
|
('Switch', 'automation.test', 'on', {}),
|
||||||
('Switch', 'remote.test', 'on', {}),
|
|
||||||
('Switch', 'input_boolean.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):
|
def test_type_switches(type_name, entity_id, state, attrs):
|
||||||
"""Test if switch types are associated correctly."""
|
"""Test if switch types are associated correctly."""
|
||||||
|
@ -9,7 +9,12 @@ from tests.common import async_mock_service
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('entity_id', [
|
@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):
|
async def test_switch_set_state(hass, entity_id):
|
||||||
"""Test if accessory and HA are updated accordingly."""
|
"""Test if accessory and HA are updated accordingly."""
|
||||||
domain = split_entity_id(entity_id)[0]
|
domain = split_entity_id(entity_id)[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user