Skip to content

Instantly share code, notes, and snippets.

@nikita2206
Created February 10, 2026 21:12
Show Gist options
  • Select an option

  • Save nikita2206/55f8474e94ead9dcc22e1bdd187f583a to your computer and use it in GitHub Desktop.

Select an option

Save nikita2206/55f8474e94ead9dcc22e1bdd187f583a to your computer and use it in GitHub Desktop.
Start Vacuum when everybody leaves house
blueprint:
name: "Vacuum prompt when nobody is home (once per day)"
description: >
When the selected presence entity indicates nobody is home, and this automation
has not fired yet today, send an actionable notification asking whether to
start vacuuming. Tapping the button starts the selected vacuum.
Requirements:
- Home Assistant Companion App on your phones (for actionable notifications).
- A notify service that targets your phones (single phone notify service OR a notify group).
domain: automation
input:
presence_entity:
name: "Presence / 'anyone home' entity"
description: >
Use a person, device_tracker, group, or a binary_sensor that represents occupancy.
Examples:
- person.family (goes to 'not_home')
- group.family (goes to 'not_home')
- binary_sensor.someone_home (goes 'off' when nobody is home)
selector:
entity:
multiple: false
vacuum_entity:
name: "Vacuum entity"
selector:
entity:
domain: vacuum
multiple: false
notify_service:
name: "Notify service"
description: >
Example: notify.mobile_app_your_phone
For multiple phones, create a notify group and select that service (e.g. notify.family).
default: "notify.notify"
selector:
text:
title:
name: "Notification title"
default: "Vacuum?"
selector:
text:
message:
name: "Notification message"
default: "Nobody is home. Start the vacuum to clean the whole house?"
selector:
text:
require_docked:
name: "Only prompt if vacuum is docked"
default: true
selector:
boolean:
prompt_timeout_minutes:
name: "How long to wait for a button press (minutes)"
default: 30
selector:
number:
min: 1
max: 180
step: 1
mode: slider
mode: single
trigger:
# person / device_tracker / group commonly use 'not_home' or 'away'
- platform: state
entity_id: !input presence_entity
to: "not_home"
- platform: state
entity_id: !input presence_entity
to: "away"
# binary_sensor commonly uses 'off' for nobody home
- platform: state
entity_id: !input presence_entity
to: "off"
condition:
# Make sure we are currently in an "away" state (covers cases where a different 'to' fired).
- condition: template
value_template: >
{{ is_state(presence, 'not_home')
or is_state(presence, 'away')
or is_state(presence, 'off') }}
# Only once per day (survives restarts because last_triggered is stored)
- condition: template
value_template: >
{{ this.attributes.last_triggered is none
or this.attributes.last_triggered < today_at() }}
# Optional: only if vacuum docked
- condition: or
conditions:
- condition: template
value_template: "{{ not require_docked }}"
- condition: template
value_template: "{{ is_state(vacuum_entity, 'docked') }}"
variables:
presence: !input presence_entity
vacuum_entity: !input vacuum_entity
require_docked: !input require_docked
notify_service: !input notify_service
title: !input title
message: !input message
timeout_mins: !input prompt_timeout_minutes
# Make action IDs unique per automation instance
action_start: "{{ (this.entity_id | replace('.','_')) ~ '_VACUUM_START' }}"
action_no: "{{ (this.entity_id | replace('.','_')) ~ '_VACUUM_NO' }}"
action:
- service: "{{ notify_service }}"
data:
title: "{{ title }}"
message: "{{ message }}"
data:
actions:
- action: "{{ action_start }}"
title: "Start vacuum"
- action: "{{ action_no }}"
title: "Not now"
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_start }}"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_no }}"
timeout: "{{ timedelta(minutes=timeout_mins) }}"
continue_on_timeout: false
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger.event.data.action == action_start }}"
sequence:
- service: vacuum.start
target:
entity_id: !input vacuum_entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment