1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-02 08:26:41 +01:00

Add lawn mower started_returning trigger (#164834)

This commit is contained in:
Robert Resch
2026-03-06 18:08:28 +01:00
committed by GitHub
parent 6d1e387911
commit 8853d3e17d
5 changed files with 33 additions and 0 deletions

View File

@@ -44,6 +44,9 @@
},
"started_mowing": {
"trigger": "mdi:play"
},
"started_returning": {
"trigger": "mdi:home-import-outline"
}
}
}

View File

@@ -139,6 +139,16 @@
}
},
"name": "Lawn mower started mowing"
},
"started_returning": {
"description": "Triggers after one or more lawn mowers start returning to dock.",
"fields": {
"behavior": {
"description": "[%key:component::lawn_mower::common::trigger_behavior_description%]",
"name": "[%key:component::lawn_mower::common::trigger_behavior_name%]"
}
},
"name": "Lawn mower started returning to dock"
}
}
}

View File

@@ -12,6 +12,9 @@ TRIGGERS: dict[str, type[Trigger]] = {
"started_mowing": make_entity_target_state_trigger(
DOMAIN, LawnMowerActivity.MOWING
),
"started_returning": make_entity_target_state_trigger(
DOMAIN, LawnMowerActivity.RETURNING
),
}

View File

@@ -18,3 +18,4 @@ docked: *trigger_common
errored: *trigger_common
paused_mowing: *trigger_common
started_mowing: *trigger_common
started_returning: *trigger_common

View File

@@ -32,6 +32,7 @@ async def target_lawn_mowers(hass: HomeAssistant) -> list[str]:
"lawn_mower.errored",
"lawn_mower.paused_mowing",
"lawn_mower.started_mowing",
"lawn_mower.started_returning",
],
)
async def test_lawn_mower_triggers_gated_by_labs_flag(
@@ -75,6 +76,11 @@ async def test_lawn_mower_triggers_gated_by_labs_flag(
target_states=[LawnMowerActivity.MOWING],
other_states=other_states(LawnMowerActivity.MOWING),
),
*parametrize_trigger_states(
trigger="lawn_mower.started_returning",
target_states=[LawnMowerActivity.RETURNING],
other_states=other_states(LawnMowerActivity.RETURNING),
),
],
)
async def test_lawn_mower_state_trigger_behavior_any(
@@ -143,6 +149,11 @@ async def test_lawn_mower_state_trigger_behavior_any(
target_states=[LawnMowerActivity.MOWING],
other_states=other_states(LawnMowerActivity.MOWING),
),
*parametrize_trigger_states(
trigger="lawn_mower.started_returning",
target_states=[LawnMowerActivity.RETURNING],
other_states=other_states(LawnMowerActivity.RETURNING),
),
],
)
async def test_lawn_mower_state_trigger_behavior_first(
@@ -210,6 +221,11 @@ async def test_lawn_mower_state_trigger_behavior_first(
target_states=[LawnMowerActivity.MOWING],
other_states=other_states(LawnMowerActivity.MOWING),
),
*parametrize_trigger_states(
trigger="lawn_mower.started_returning",
target_states=[LawnMowerActivity.RETURNING],
other_states=other_states(LawnMowerActivity.RETURNING),
),
],
)
async def test_lawn_mower_state_trigger_behavior_last(