mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Tweak device action scaffold, fix typo (#51751)
This commit is contained in:
parent
b83b82ca7d
commit
bf6a412be0
@ -51,24 +51,14 @@ async def async_get_triggers(hass: HomeAssistant, device_id: str) -> list[dict]:
|
|||||||
|
|
||||||
# Add triggers for each entity that belongs to this integration
|
# Add triggers for each entity that belongs to this integration
|
||||||
# TODO add your own triggers.
|
# TODO add your own triggers.
|
||||||
triggers.append(
|
base_trigger = {
|
||||||
{
|
CONF_PLATFORM: "device",
|
||||||
CONF_PLATFORM: "device",
|
CONF_DEVICE_ID: device_id,
|
||||||
CONF_DEVICE_ID: device_id,
|
CONF_DOMAIN: DOMAIN,
|
||||||
CONF_DOMAIN: DOMAIN,
|
CONF_ENTITY_ID: entry.entity_id,
|
||||||
CONF_ENTITY_ID: entry.entity_id,
|
}
|
||||||
CONF_TYPE: "turned_on",
|
triggers.append({**base_trigger, CONF_TYPE: "turned_on"})
|
||||||
}
|
triggers.append({**base_trigger, CONF_TYPE: "turned_off"})
|
||||||
)
|
|
||||||
triggers.append(
|
|
||||||
{
|
|
||||||
CONF_PLATFORM: "device",
|
|
||||||
CONF_DEVICE_ID: device_id,
|
|
||||||
CONF_DOMAIN: DOMAIN,
|
|
||||||
CONF_ENTITY_ID: entry.entity_id,
|
|
||||||
CONF_TYPE: "turned_off",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return triggers
|
return triggers
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ async def test_capabilities(
|
|||||||
"action,capability_name",
|
"action,capability_name",
|
||||||
[("set_hvac_mode", "hvac_mode"), ("set_preset_mode", "preset_mode")],
|
[("set_hvac_mode", "hvac_mode"), ("set_preset_mode", "preset_mode")],
|
||||||
)
|
)
|
||||||
async def test_capabilities_mising_entity(
|
async def test_capabilities_missing_entity(
|
||||||
hass, device_reg, entity_reg, action, capability_name
|
hass, device_reg, entity_reg, action, capability_name
|
||||||
):
|
):
|
||||||
"""Test getting capabilities."""
|
"""Test getting capabilities."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user