Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions homeassistant/components/vacuum/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,19 @@
},
"triggers": {
"docked": {
"trigger": "mdi:home-import-outline"
"trigger": "mdi:home-outline"
},
"errored": {
"trigger": "mdi:alert-circle-outline"
},
"paused_cleaning": {
"trigger": "mdi:pause"
},
"returning": {
"trigger": "mdi:home-import-outline"
},
"started_cleaning": {
"trigger": "mdi:play"
}
}
}
}
14 changes: 12 additions & 2 deletions homeassistant/components/vacuum/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"title": "Vacuum",
"triggers": {
"docked": {
"description": "Triggers after one or more vacuums return to dock.",
"description": "Triggers after one or more vacuums have returned to dock.",
"fields": {
"behavior": {
"description": "[%key:component::vacuum::common::trigger_behavior_description%]",
Expand Down Expand Up @@ -142,6 +142,16 @@
},
"name": "Vacuum cleaner paused cleaning"
},
"returning": {
"description": "Triggers after one or more vacuums begin returning to dock.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Triggers after one or more vacuums begin returning to dock.",
"description": "Triggers after one or more vacuums start returning to dock.",

"fields": {
"behavior": {
"description": "[%key:component::vacuum::common::trigger_behavior_description%]",
"name": "[%key:component::vacuum::common::trigger_behavior_name%]"
}
},
"name": "Vacuum cleaner returning to dock"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"name": "Vacuum cleaner returning to dock"
"name": "Vacuum cleaner started returning to dock"

},
"started_cleaning": {
"description": "Triggers after one or more vacuums start cleaning.",
"fields": {
Expand All @@ -153,4 +163,4 @@
"name": "Vacuum cleaner started cleaning"
}
}
}
}
1 change: 1 addition & 0 deletions homeassistant/components/vacuum/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"docked": make_entity_state_trigger(DOMAIN, VacuumActivity.DOCKED),
"errored": make_entity_state_trigger(DOMAIN, VacuumActivity.ERROR),
"paused_cleaning": make_entity_state_trigger(DOMAIN, VacuumActivity.PAUSED),
"returning": make_entity_state_trigger(DOMAIN, VacuumActivity.RETURNING),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the name. The other triggers are named using past tense. We should preferably follow the same pattern here, eg "started_returning".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"returning": make_entity_state_trigger(DOMAIN, VacuumActivity.RETURNING),
"started_returning": make_entity_state_trigger(DOMAIN, VacuumActivity.RETURNING),

"started_cleaning": make_entity_state_trigger(DOMAIN, VacuumActivity.CLEANING),
}

Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/vacuum/triggers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
docked: *trigger_common
errored: *trigger_common
paused_cleaning: *trigger_common
returning: *trigger_common
started_cleaning: *trigger_common
16 changes: 16 additions & 0 deletions tests/components/vacuum/test_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async def target_vacuums(hass: HomeAssistant) -> list[str]:
"vacuum.docked",
"vacuum.errored",
"vacuum.paused_cleaning",
"vacuum.returning",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"vacuum.returning",
"vacuum.started_returning",

"vacuum.started_cleaning",
],
)
Expand Down Expand Up @@ -86,6 +87,11 @@ async def test_vacuum_triggers_gated_by_labs_flag(
target_states=[VacuumActivity.PAUSED],
other_states=other_states(VacuumActivity.PAUSED),
),
*parametrize_trigger_states(
trigger="vacuum.returning",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trigger="vacuum.returning",
trigger="vacuum.started_returning",

target_states=[VacuumActivity.RETURNING],
other_states=other_states(VacuumActivity.RETURNING),
),
*parametrize_trigger_states(
trigger="vacuum.started_cleaning",
target_states=[VacuumActivity.CLEANING],
Expand Down Expand Up @@ -153,6 +159,11 @@ async def test_vacuum_state_trigger_behavior_any(
target_states=[VacuumActivity.PAUSED],
other_states=other_states(VacuumActivity.PAUSED),
),
*parametrize_trigger_states(
trigger="vacuum.returning",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trigger="vacuum.returning",
trigger="vacuum.started_returning",

target_states=[VacuumActivity.RETURNING],
other_states=other_states(VacuumActivity.RETURNING),
),
*parametrize_trigger_states(
trigger="vacuum.started_cleaning",
target_states=[VacuumActivity.CLEANING],
Expand Down Expand Up @@ -219,6 +230,11 @@ async def test_vacuum_state_trigger_behavior_first(
target_states=[VacuumActivity.PAUSED],
other_states=other_states(VacuumActivity.PAUSED),
),
*parametrize_trigger_states(
trigger="vacuum.returning",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trigger="vacuum.returning",
trigger="vacuum.started_returning",

target_states=[VacuumActivity.RETURNING],
other_states=other_states(VacuumActivity.RETURNING),
),
*parametrize_trigger_states(
trigger="vacuum.started_cleaning",
target_states=[VacuumActivity.CLEANING],
Expand Down