Files
N22/include/automations/roborock.yaml
T
claus 1e71bc5372 feat(roborock): add mobile notifications for cleaning start, stop, and failure
- Send push notification on successful auto-start of cleaning
- Include elapsed empty-house time in start notification
- Add failure notification if robot fails to start after retries
- Notify when cleaning is stopped due to someone arriving home
- Ensure notifications only trigger on actual state outcomes (not attempts)
2026-03-19 19:02:05 +01:00

138 lines
3.7 KiB
YAML

- id: track_house_empty_time
alias: Track House Empty Time
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.family_presence
to: "off"
condition:
- condition: template
value_template: "{{ trigger.from_state.state != 'unavailable' }}"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.house_became_empty
data:
timestamp: "{{ now().timestamp() }}"
- id: roborock_reset_daily_counter
alias: Roborock Reset Daily Counter
trigger:
- platform: time
at: "00:00:00"
action:
- service: input_number.set_value
target:
entity_id: input_number.roborock_auto_runs_today
data:
value: 0
- id: roborock_smart_cleaning_start
alias: Roborock Smart Cleaning Start
mode: single
trigger:
- platform: time_pattern
minutes: "/5"
condition:
- condition: state
entity_id: binary_sensor.family_presence
state: "off"
- condition: template
value_template: >
{{ states('input_datetime.house_became_empty') not in ['unknown','unavailable',''] and
(as_timestamp(now()) - as_timestamp(states('input_datetime.house_became_empty'))) > 1800 }}
- condition: numeric_state
entity_id: input_number.roborock_auto_runs_today
below: 2
- condition: template
value_template: >
{{ states('vacuum.roborock_s8_pro_ultra') in ['docked','idle','charging'] }}
- condition: numeric_state
entity_id: vacuum.roborock_s8_pro_ultra
attribute: battery_level
above: 20
action:
- variables:
started: false
- repeat:
count: 3
sequence:
- service: button.press
target:
entity_id: button.roborock_s8_pro_ultra_kokken_bryggers
- delay: "00:00:20"
- if:
- condition: state
entity_id: vacuum.roborock_s8_pro_ultra
state: "cleaning"
then:
- variables:
started: true
- stop: "Cleaning started"
- choose:
# ✅ SUCCESS → send notifikation
- conditions:
- condition: template
value_template: "{{ started }}"
sequence:
- service: input_number.increment
target:
entity_id: input_number.roborock_auto_runs_today
- service: notify.mobile_app_clausiphone15
data:
title: "🧹 Roborock startet"
message: >
Rengøring startet automatisk.
Hus har været tomt i {{ ((as_timestamp(now()) - as_timestamp(states('input_datetime.house_became_empty'))) / 60) | int }} min.
# ❌ FAIL → send fejl-notifikation
- conditions:
- condition: template
value_template: "{{ not started }}"
sequence:
- service: notify.mobile_app_clausiphone15
data:
title: "⚠️ Roborock start fejlede"
message: "Automation forsøgte 3 gange uden succes."
- id: roborock_stop_when_home
alias: Roborock Stop When Someone Comes Home
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.family_presence
to: "on"
condition:
- condition: state
entity_id: vacuum.roborock_s8_pro_ultra
state: "cleaning"
action:
- service: vacuum.return_to_base
target:
entity_id: vacuum.roborock_s8_pro_ultra
- service: notify.mobile_app_clausiphone15
data:
title: "🏠 Roborock stoppet"
message: "Rengøring stoppet fordi nogen er kommet hjem."