Files
N22/include/templates/roborock.yaml
T

35 lines
1.3 KiB
YAML

- trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.roborock_s8_pro_ultra_last_clean_end
- platform: state
entity_id: vacuum.roborock_s8_pro_ultra
- platform: state
entity_id:
- automation.roborock_smart_cleaning_start
- automation.roborock_syd_workday_vacuum
- automation.roborock_syd_workday_mop
attribute: last_triggered
- platform: time_pattern
hours: "/2"
sensor:
- name: "Roborock Last Clean End Compact"
unique_id: roborock_last_clean_end_compact
state: >
{% set raw = states('sensor.roborock_s8_pro_ultra_last_clean_end') %}
{% if raw in ['unknown', 'unavailable', '', none] %}
Ukendt
{% else %}
{% set dt = as_datetime(raw) %}
{% if dt is none %}
Ukendt
{% elif dt.date() == now().date() %}
i dag {{ dt.strftime('%H:%M') }}
{% elif dt.date() == (now() + timedelta(days=1)).date() %}
i morgen {{ dt.strftime('%H:%M') }}
{% else %}
{% set weekdays = ['man', 'tir', 'ons', 'tor', 'fre', 'lør', 'søn'] %}
{{ weekdays[dt.weekday()] }} {{ dt.strftime('%H:%M') }}
{% endif %}
{% endif %}