diff --git a/tests/components/alarm_control_panel/test_device_action.py b/tests/components/alarm_control_panel/test_device_action.py index 75f1dc76aaf..f4b0832ad97 100644 --- a/tests/components/alarm_control_panel/test_device_action.py +++ b/tests/components/alarm_control_panel/test_device_action.py @@ -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: diff --git a/tests/components/alarm_control_panel/test_device_condition.py b/tests/components/alarm_control_panel/test_device_condition.py index d0644562850..b44e6ba7e8b 100644 --- a/tests/components/alarm_control_panel/test_device_condition.py +++ b/tests/components/alarm_control_panel/test_device_condition.py @@ -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) diff --git a/tests/components/alarm_control_panel/test_device_trigger.py b/tests/components/alarm_control_panel/test_device_trigger.py index 9edda7e98e2..e874b50baa0 100644 --- a/tests/components/alarm_control_panel/test_device_trigger.py +++ b/tests/components/alarm_control_panel/test_device_trigger.py @@ -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( diff --git a/tests/components/arcam_fmj/test_device_trigger.py b/tests/components/arcam_fmj/test_device_trigger.py index d5ab820ce46..fe2507e3d8e 100644 --- a/tests/components/arcam_fmj/test_device_trigger.py +++ b/tests/components/arcam_fmj/test_device_trigger.py @@ -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: diff --git a/tests/components/binary_sensor/test_device_condition.py b/tests/components/binary_sensor/test_device_condition.py index 5a609fbc30a..2e23fd799f2 100644 --- a/tests/components/binary_sensor/test_device_condition.py +++ b/tests/components/binary_sensor/test_device_condition.py @@ -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 diff --git a/tests/components/binary_sensor/test_device_trigger.py b/tests/components/binary_sensor/test_device_trigger.py index 0cf76453238..001af0b1e64 100644 --- a/tests/components/binary_sensor/test_device_trigger.py +++ b/tests/components/binary_sensor/test_device_trigger.py @@ -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 diff --git a/tests/components/button/test_device_action.py b/tests/components/button/test_device_action.py index 984be163d42..ab1e145cdb1 100644 --- a/tests/components/button/test_device_action.py +++ b/tests/components/button/test_device_action.py @@ -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) diff --git a/tests/components/button/test_device_trigger.py b/tests/components/button/test_device_trigger.py index 913aec9088e..88534941aa9 100644 --- a/tests/components/button/test_device_trigger.py +++ b/tests/components/button/test_device_trigger.py @@ -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) diff --git a/tests/components/climate/test_device_action.py b/tests/components/climate/test_device_action.py index 3f9b1148443..4f926e1b094 100644 --- a/tests/components/climate/test_device_action.py +++ b/tests/components/climate/test_device_action.py @@ -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) diff --git a/tests/components/climate/test_device_condition.py b/tests/components/climate/test_device_condition.py index 2d6aa82fdf1..65c1e17048b 100644 --- a/tests/components/climate/test_device_condition.py +++ b/tests/components/climate/test_device_condition.py @@ -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) diff --git a/tests/components/climate/test_device_trigger.py b/tests/components/climate/test_device_trigger.py index 017385362d1..523a9f04a8b 100644 --- a/tests/components/climate/test_device_trigger.py +++ b/tests/components/climate/test_device_trigger.py @@ -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) diff --git a/tests/components/cover/test_device_action.py b/tests/components/cover/test_device_action.py index 491b59d9acb..7954b3389e1 100644 --- a/tests/components/cover/test_device_action.py +++ b/tests/components/cover/test_device_action.py @@ -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"} diff --git a/tests/components/cover/test_device_condition.py b/tests/components/cover/test_device_condition.py index efa8e8b3383..b964ad8bc0d 100644 --- a/tests/components/cover/test_device_condition.py +++ b/tests/components/cover/test_device_condition.py @@ -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( diff --git a/tests/components/cover/test_device_trigger.py b/tests/components/cover/test_device_trigger.py index 0c7c99bc521..323394e9fe3 100644 --- a/tests/components/cover/test_device_trigger.py +++ b/tests/components/cover/test_device_trigger.py @@ -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( diff --git a/tests/components/deconz/test_device_trigger.py b/tests/components/deconz/test_device_trigger.py index 265aec78270..15e63a6a81f 100644 --- a/tests/components/deconz/test_device_trigger.py +++ b/tests/components/deconz/test_device_trigger.py @@ -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 = [] diff --git a/tests/components/device_tracker/test_device_condition.py b/tests/components/device_tracker/test_device_condition.py index 7e3f79712c4..070d2b6fec3 100644 --- a/tests/components/device_tracker/test_device_condition.py +++ b/tests/components/device_tracker/test_device_condition.py @@ -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) diff --git a/tests/components/device_tracker/test_device_trigger.py b/tests/components/device_tracker/test_device_trigger.py index 0ec1ee67d36..dc9a5fe80fe 100644 --- a/tests/components/device_tracker/test_device_trigger.py +++ b/tests/components/device_tracker/test_device_trigger.py @@ -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) diff --git a/tests/components/fan/test_device_action.py b/tests/components/fan/test_device_action.py index 491e6afab6a..eb31a2ece42 100644 --- a/tests/components/fan/test_device_action.py +++ b/tests/components/fan/test_device_action.py @@ -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) diff --git a/tests/components/fan/test_device_condition.py b/tests/components/fan/test_device_condition.py index 8f11d963ed3..d8e60e7d6ca 100644 --- a/tests/components/fan/test_device_condition.py +++ b/tests/components/fan/test_device_condition.py @@ -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) diff --git a/tests/components/fan/test_device_trigger.py b/tests/components/fan/test_device_trigger.py index cecb4151c3f..c58b9004cde 100644 --- a/tests/components/fan/test_device_trigger.py +++ b/tests/components/fan/test_device_trigger.py @@ -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