Use DeviceAutomationType in tests/components/[a-f]* (#62440)
parent
c5e6489475
commit
5926961ed5
tests/components
alarm_control_panel
arcam_fmj
binary_sensor
deconz
device_tracker
|
@ -3,6 +3,7 @@ import pytest
|
|||
|
||||
from homeassistant.components.alarm_control_panel import DOMAIN, const
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
CONF_PLATFORM,
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
|
@ -92,7 +93,9 @@ async def test_get_actions(
|
|||
}
|
||||
for action in expected_action_types
|
||||
]
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert_lists_same(actions, expected_actions)
|
||||
|
||||
|
||||
|
@ -122,7 +125,9 @@ async def test_get_actions_arm_night_only(hass, device_reg, entity_reg):
|
|||
"entity_id": "alarm_control_panel.test_5678",
|
||||
},
|
||||
]
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert_lists_same(actions, expected_actions)
|
||||
|
||||
|
||||
|
@ -158,7 +163,9 @@ async def test_get_action_capabilities(
|
|||
},
|
||||
"trigger": {"extra_fields": []},
|
||||
}
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert len(actions) == 6
|
||||
assert {action["type"] for action in actions} == set(expected_capabilities)
|
||||
for action in actions:
|
||||
|
@ -208,7 +215,9 @@ async def test_get_action_capabilities_arm_code(
|
|||
},
|
||||
"trigger": {"extra_fields": []},
|
||||
}
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert len(actions) == 6
|
||||
assert {action["type"] for action in actions} == set(expected_capabilities)
|
||||
for action in actions:
|
||||
|
|
|
@ -3,6 +3,7 @@ import pytest
|
|||
|
||||
from homeassistant.components.alarm_control_panel import DOMAIN, const
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_CUSTOM_BYPASS,
|
||||
|
@ -112,7 +113,9 @@ async def test_get_conditions(
|
|||
}
|
||||
for condition in expected_condition_types
|
||||
]
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert_lists_same(conditions, expected_conditions)
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import pytest
|
|||
|
||||
from homeassistant.components.alarm_control_panel import DOMAIN
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
|
@ -125,7 +126,9 @@ async def test_get_triggers(
|
|||
}
|
||||
for trigger in expected_trigger_types
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert_lists_same(triggers, expected_triggers)
|
||||
|
||||
|
||||
|
@ -142,7 +145,9 @@ async def test_get_trigger_capabilities(hass, device_reg, entity_reg):
|
|||
"alarm_control_panel.test_5678", "attributes", {"supported_features": 15}
|
||||
)
|
||||
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert len(triggers) == 6
|
||||
for trigger in triggers:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
|
|
|
@ -3,6 +3,7 @@ import pytest
|
|||
|
||||
from homeassistant.components.arcam_fmj.const import DOMAIN
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import (
|
||||
|
@ -53,10 +54,14 @@ async def test_get_triggers(hass, device_reg, entity_reg):
|
|||
"entity_id": "media_player.arcam_fmj_5678",
|
||||
},
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
|
||||
# Test triggers are either arcam_fmj specific or media_player entity triggers
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
for expected_trigger in expected_triggers:
|
||||
assert expected_trigger in triggers
|
||||
for trigger in triggers:
|
||||
|
|
|
@ -7,6 +7,7 @@ import pytest
|
|||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.binary_sensor import DEVICE_CLASSES, DOMAIN
|
||||
from homeassistant.components.binary_sensor.device_condition import ENTITY_CONDITIONS
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -74,7 +75,9 @@ async def test_get_conditions(hass, device_reg, entity_reg, enable_custom_integr
|
|||
for device_class in DEVICE_CLASSES
|
||||
for condition in ENTITY_CONDITIONS[device_class]
|
||||
]
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert conditions == expected_conditions
|
||||
|
||||
|
||||
|
@ -109,7 +112,9 @@ async def test_get_conditions_no_state(hass, device_reg, entity_reg):
|
|||
for device_class in DEVICE_CLASSES
|
||||
for condition in ENTITY_CONDITIONS[device_class]
|
||||
]
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert conditions == expected_conditions
|
||||
|
||||
|
||||
|
@ -127,7 +132,9 @@ async def test_get_condition_capabilities(hass, device_reg, entity_reg):
|
|||
{"name": "for", "optional": True, "type": "positive_time_period_dict"}
|
||||
]
|
||||
}
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
for condition in conditions:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
hass, "condition", condition
|
||||
|
|
|
@ -6,6 +6,7 @@ import pytest
|
|||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.binary_sensor import DEVICE_CLASSES, DOMAIN
|
||||
from homeassistant.components.binary_sensor.device_trigger import ENTITY_TRIGGERS
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -74,7 +75,9 @@ async def test_get_triggers(hass, device_reg, entity_reg, enable_custom_integrat
|
|||
for device_class in DEVICE_CLASSES
|
||||
for trigger in ENTITY_TRIGGERS[device_class]
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert triggers == expected_triggers
|
||||
|
||||
|
||||
|
@ -112,7 +115,9 @@ async def test_get_triggers_no_state(hass, device_reg, entity_reg):
|
|||
for device_class in DEVICE_CLASSES
|
||||
for trigger in ENTITY_TRIGGERS[device_class]
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert triggers == expected_triggers
|
||||
|
||||
|
||||
|
@ -130,7 +135,9 @@ async def test_get_trigger_capabilities(hass, device_reg, entity_reg):
|
|||
{"name": "for", "optional": True, "type": "positive_time_period_dict"}
|
||||
]
|
||||
}
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
for trigger in triggers:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
hass, "trigger", trigger
|
||||
|
|
|
@ -3,6 +3,7 @@ import pytest
|
|||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.button import DOMAIN
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry, entity_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -50,7 +51,9 @@ async def test_get_actions(
|
|||
"entity_id": "button.test_5678",
|
||||
}
|
||||
]
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert_lists_same(actions, expected_actions)
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import pytest
|
|||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.button import DOMAIN
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.helpers.entity_registry import EntityRegistry
|
||||
|
@ -60,7 +61,9 @@ async def test_get_triggers(
|
|||
"entity_id": f"{DOMAIN}.test_5678",
|
||||
}
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert_lists_same(triggers, expected_triggers)
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import voluptuous_serialize
|
|||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.climate import DOMAIN, const, device_action
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.helpers import config_validation as cv, device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
@ -79,7 +80,9 @@ async def test_get_actions(
|
|||
for action in expected_action_types
|
||||
]
|
||||
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert_lists_same(actions, expected_actions)
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import voluptuous_serialize
|
|||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.climate import DOMAIN, const, device_condition
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.helpers import config_validation as cv, device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
@ -83,7 +84,9 @@ async def test_get_conditions(
|
|||
}
|
||||
for condition in expected_condition_types
|
||||
]
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert_lists_same(conditions, expected_conditions)
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import voluptuous_serialize
|
|||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.climate import DOMAIN, const, device_trigger
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.helpers import config_validation as cv, device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -79,7 +80,9 @@ async def test_get_triggers(hass, device_reg, entity_reg):
|
|||
"entity_id": entity_id,
|
||||
},
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert_lists_same(triggers, expected_triggers)
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ from homeassistant.components.cover import (
|
|||
SUPPORT_STOP,
|
||||
SUPPORT_STOP_TILT,
|
||||
)
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -101,7 +102,9 @@ async def test_get_actions(
|
|||
}
|
||||
for action in expected_action_types
|
||||
]
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert_lists_same(actions, expected_actions)
|
||||
|
||||
|
||||
|
@ -140,7 +143,9 @@ async def test_get_action_capabilities(
|
|||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert len(actions) == 5 # open, close, open_tilt, close_tilt
|
||||
action_types = {action["type"] for action in actions}
|
||||
assert action_types == {"open", "close", "stop", "open_tilt", "close_tilt"}
|
||||
|
@ -184,7 +189,9 @@ async def test_get_action_capabilities_set_pos(
|
|||
}
|
||||
]
|
||||
}
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert len(actions) == 1 # set_position
|
||||
action_types = {action["type"] for action in actions}
|
||||
assert action_types == {"set_position"}
|
||||
|
@ -231,7 +238,9 @@ async def test_get_action_capabilities_set_tilt_pos(
|
|||
}
|
||||
]
|
||||
}
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert len(actions) == 3
|
||||
action_types = {action["type"] for action in actions}
|
||||
assert action_types == {"open", "close", "set_tilt_position"}
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.components.cover import (
|
|||
SUPPORT_SET_POSITION,
|
||||
SUPPORT_SET_TILT_POSITION,
|
||||
)
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
CONF_PLATFORM,
|
||||
STATE_CLOSED,
|
||||
|
@ -105,7 +106,9 @@ async def test_get_conditions(
|
|||
}
|
||||
for condition in expected_condition_types
|
||||
]
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert_lists_same(conditions, expected_conditions)
|
||||
|
||||
|
||||
|
@ -129,7 +132,9 @@ async def test_get_condition_capabilities(
|
|||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert len(conditions) == 4
|
||||
for condition in conditions:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
|
@ -178,7 +183,9 @@ async def test_get_condition_capabilities_set_pos(
|
|||
},
|
||||
]
|
||||
}
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert len(conditions) == 5
|
||||
for condition in conditions:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
|
@ -230,7 +237,9 @@ async def test_get_condition_capabilities_set_tilt_pos(
|
|||
},
|
||||
]
|
||||
}
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert len(conditions) == 5
|
||||
for condition in conditions:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
|
|
|
@ -10,6 +10,7 @@ from homeassistant.components.cover import (
|
|||
SUPPORT_SET_POSITION,
|
||||
SUPPORT_SET_TILT_POSITION,
|
||||
)
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
CONF_PLATFORM,
|
||||
STATE_CLOSED,
|
||||
|
@ -125,7 +126,9 @@ async def test_get_triggers(
|
|||
}
|
||||
for trigger in expected_trigger_types
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert_lists_same(triggers, expected_triggers)
|
||||
|
||||
|
||||
|
@ -149,7 +152,9 @@ async def test_get_trigger_capabilities(
|
|||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
|
||||
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert len(triggers) == 4
|
||||
for trigger in triggers:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
|
@ -202,7 +207,9 @@ async def test_get_trigger_capabilities_set_pos(
|
|||
},
|
||||
]
|
||||
}
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert len(triggers) == 5
|
||||
for trigger in triggers:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
|
@ -262,7 +269,9 @@ async def test_get_trigger_capabilities_set_tilt_pos(
|
|||
},
|
||||
]
|
||||
}
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert len(triggers) == 5
|
||||
for trigger in triggers:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
|
|
|
@ -8,6 +8,7 @@ from homeassistant.components.automation import DOMAIN as AUTOMATION_DOMAIN
|
|||
from homeassistant.components.deconz import device_trigger
|
||||
from homeassistant.components.deconz.const import DOMAIN as DECONZ_DOMAIN
|
||||
from homeassistant.components.deconz.device_trigger import CONF_SUBTYPE
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL,
|
||||
|
@ -69,7 +70,9 @@ async def test_get_triggers(hass, aioclient_mock):
|
|||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
)
|
||||
|
||||
triggers = await async_get_device_automations(hass, "trigger", device.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device.id
|
||||
)
|
||||
|
||||
expected_triggers = [
|
||||
{
|
||||
|
@ -158,7 +161,9 @@ async def test_get_triggers_manage_unsupported_remotes(hass, aioclient_mock):
|
|||
identifiers={(DECONZ_DOMAIN, "d0:cf:5e:ff:fe:71:a4:3a")}
|
||||
)
|
||||
|
||||
triggers = await async_get_device_automations(hass, "trigger", device.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device.id
|
||||
)
|
||||
|
||||
expected_triggers = []
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.device_tracker import DOMAIN
|
||||
from homeassistant.const import STATE_HOME
|
||||
from homeassistant.helpers import device_registry
|
||||
|
@ -61,7 +62,9 @@ async def test_get_conditions(hass, device_reg, entity_reg):
|
|||
"entity_id": f"{DOMAIN}.test_5678",
|
||||
},
|
||||
]
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert_lists_same(conditions, expected_conditions)
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import pytest
|
|||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.device_tracker import DOMAIN, device_trigger
|
||||
import homeassistant.components.zone as zone
|
||||
from homeassistant.helpers import config_validation as cv, device_registry
|
||||
|
@ -87,7 +88,9 @@ async def test_get_triggers(hass, device_reg, entity_reg):
|
|||
"entity_id": f"{DOMAIN}.test_5678",
|
||||
},
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert_lists_same(triggers, expected_triggers)
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.fan import DOMAIN
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -52,7 +53,9 @@ async def test_get_actions(hass, device_reg, entity_reg):
|
|||
"entity_id": "fan.test_5678",
|
||||
},
|
||||
]
|
||||
actions = await async_get_device_automations(hass, "action", device_entry.id)
|
||||
actions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.ACTION, device_entry.id
|
||||
)
|
||||
assert_lists_same(actions, expected_actions)
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.fan import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers import device_registry
|
||||
|
@ -61,7 +62,9 @@ async def test_get_conditions(hass, device_reg, entity_reg):
|
|||
"entity_id": f"{DOMAIN}.test_5678",
|
||||
},
|
||||
]
|
||||
conditions = await async_get_device_automations(hass, "condition", device_entry.id)
|
||||
conditions = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.CONDITION, device_entry.id
|
||||
)
|
||||
assert_lists_same(conditions, expected_conditions)
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.fan import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers import device_registry
|
||||
|
@ -66,7 +67,9 @@ async def test_get_triggers(hass, device_reg, entity_reg):
|
|||
"entity_id": f"{DOMAIN}.test_5678",
|
||||
},
|
||||
]
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
assert_lists_same(triggers, expected_triggers)
|
||||
|
||||
|
||||
|
@ -84,7 +87,9 @@ async def test_get_trigger_capabilities(hass, device_reg, entity_reg):
|
|||
{"name": "for", "optional": True, "type": "positive_time_period_dict"}
|
||||
]
|
||||
}
|
||||
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
|
||||
triggers = await async_get_device_automations(
|
||||
hass, DeviceAutomationType.TRIGGER, device_entry.id
|
||||
)
|
||||
for trigger in triggers:
|
||||
capabilities = await async_get_device_automation_capabilities(
|
||||
hass, "trigger", trigger
|
||||
|
|
Loading…
Reference in New Issue