Files
N22/include/automations/roborock.yaml
T

193 lines
4.6 KiB
YAML

# 🏠 Track hvornår huset bliver tomt
- id: track_house_empty_time
alias: Track House Empty Time
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.family_presence
to: "off"
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: binary_sensor.family_presence
state: "off"
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.house_became_empty
data:
timestamp: "{{ now().timestamp() }}"
# 🔄 Reset daglig tæller
- 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
# 🤖 Smart rengøring
- 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: >
{% set t = state_attr('input_datetime.house_became_empty', 'timestamp') %}
{{ t is not none and (as_timestamp(now()) - t) > 300 }}
- condition: numeric_state
entity_id: input_number.roborock_auto_runs_today
below: 2
- condition: not
conditions:
- condition: state
entity_id: vacuum.roborock_s8_pro_ultra
state: "cleaning"
- condition: template
value_template: >
{{ state_attr('vacuum.roborock_s8_pro_ultra','battery_level') | int(0) > 20 }}
action:
- service: button.press
target:
entity_id: button.roborock_s8_pro_ultra_kokken_bryggers
- delay: "00:00:20"
- choose:
- conditions:
- condition: state
entity_id: vacuum.roborock_s8_pro_ultra
state: "cleaning"
sequence:
- service: input_number.increment
target:
entity_id: input_number.roborock_auto_runs_today
- service: notify.mobile_app_claus_iphone_15pro
data:
title: "🧹 Roborock startet"
message: >
Hus har været tomt i {{
((as_timestamp(now()) - state_attr('input_datetime.house_became_empty','timestamp')) / 60) | int
}} min.
- conditions:
- condition: not
conditions:
- condition: state
entity_id: vacuum.roborock_s8_pro_ultra
state: "cleaning"
sequence:
- service: notify.mobile_app_claus_iphone_15pro
data:
title: "⚠️ Roborock start fejlede"
message: "Startkommando sendt, men den begyndte ikke at køre."
# 🏠 Stop når nogen kommer hjem
- 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_claus_iphone_15pro
data:
title: "🏠 Roborock stoppet"
message: "Rengøring stoppet fordi nogen er kommet hjem."
# 🧹 Syd på arbejdsdage
- id: roborock_syd_workday_vacuum
alias: Roborock støvsug syd på arbejdsdage
mode: single
trigger:
- platform: time
at: "10:00:00"
condition:
- condition: state
entity_id: binary_sensor.arbejdsdag
state: "on"
- condition: not
conditions:
- condition: state
entity_id: vacuum.roborock_s8_pro_ultra
state: "cleaning"
action:
- service: button.press
target:
entity_id: button.roborock_s8_pro_ultra_syd
# 🧽 Syd vask på arbejdsdage mandag og onsdag
- id: roborock_syd_workday_mop
alias: Roborock vask syd på arbejdsdage mandag og onsdag
mode: single
trigger:
- platform: time
at: "12:00:00"
condition:
- condition: state
entity_id: binary_sensor.arbejdsdag
state: "on"
- condition: time
weekday:
- mon
- wed
- condition: not
conditions:
- condition: state
entity_id: vacuum.roborock_s8_pro_ultra
state: "cleaning"
action:
- service: button.press
target:
entity_id: button.roborock_s8_pro_ultra_syd_vask