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)
This commit is contained in:
@@ -36,41 +36,37 @@
|
|||||||
mode: single
|
mode: single
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
# Tjek løbende mens huset er tomt
|
|
||||||
- platform: time_pattern
|
- platform: time_pattern
|
||||||
minutes: "/5"
|
minutes: "/5"
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
# Huset er tomt
|
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.family_presence
|
entity_id: binary_sensor.family_presence
|
||||||
state: "off"
|
state: "off"
|
||||||
|
|
||||||
# Har været tomt i 30 min (robust)
|
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{{ states('input_datetime.house_became_empty') not in ['unknown','unavailable',''] and
|
{{ states('input_datetime.house_became_empty') not in ['unknown','unavailable',''] and
|
||||||
(as_timestamp(now()) - as_timestamp(states('input_datetime.house_became_empty'))) > 1800 }}
|
(as_timestamp(now()) - as_timestamp(states('input_datetime.house_became_empty'))) > 1800 }}
|
||||||
|
|
||||||
# Max 2 gange dagligt
|
|
||||||
- condition: numeric_state
|
- condition: numeric_state
|
||||||
entity_id: input_number.roborock_auto_runs_today
|
entity_id: input_number.roborock_auto_runs_today
|
||||||
below: 2
|
below: 2
|
||||||
|
|
||||||
# Støvsuger klar (robust state check)
|
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{{ states('vacuum.roborock_s8_pro_ultra') in ['docked','idle','charging'] }}
|
{{ states('vacuum.roborock_s8_pro_ultra') in ['docked','idle','charging'] }}
|
||||||
|
|
||||||
# Batteri OK
|
|
||||||
- condition: numeric_state
|
- condition: numeric_state
|
||||||
entity_id: vacuum.roborock_s8_pro_ultra
|
entity_id: vacuum.roborock_s8_pro_ultra
|
||||||
attribute: battery_level
|
attribute: battery_level
|
||||||
above: 20
|
above: 20
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- alias: "Start cleaning (retry op til 3 gange)"
|
- variables:
|
||||||
repeat:
|
started: false
|
||||||
|
|
||||||
|
- repeat:
|
||||||
count: 3
|
count: 3
|
||||||
sequence:
|
sequence:
|
||||||
- service: button.press
|
- service: button.press
|
||||||
@@ -79,14 +75,43 @@
|
|||||||
|
|
||||||
- delay: "00:00:20"
|
- delay: "00:00:20"
|
||||||
|
|
||||||
- condition: state
|
- if:
|
||||||
entity_id: vacuum.roborock_s8_pro_ultra
|
- condition: state
|
||||||
state: "cleaning"
|
entity_id: vacuum.roborock_s8_pro_ultra
|
||||||
|
state: "cleaning"
|
||||||
|
then:
|
||||||
|
- variables:
|
||||||
|
started: true
|
||||||
|
- stop: "Cleaning started"
|
||||||
|
|
||||||
- service: input_number.increment
|
- choose:
|
||||||
target:
|
|
||||||
entity_id: input_number.roborock_auto_runs_today
|
|
||||||
|
|
||||||
|
# ✅ 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
|
- id: roborock_stop_when_home
|
||||||
alias: Roborock Stop When Someone Comes Home
|
alias: Roborock Stop When Someone Comes Home
|
||||||
mode: restart
|
mode: restart
|
||||||
@@ -105,3 +130,8 @@
|
|||||||
- service: vacuum.return_to_base
|
- service: vacuum.return_to_base
|
||||||
target:
|
target:
|
||||||
entity_id: vacuum.roborock_s8_pro_ultra
|
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."
|
||||||
|
|||||||
Reference in New Issue
Block a user