Improve Roborock last clean sensor refresh
This commit is contained in:
@@ -2,26 +2,39 @@
|
|||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
event: start
|
event: start
|
||||||
- platform: state
|
- platform: state
|
||||||
|
id: last_clean_end_changed
|
||||||
entity_id: sensor.roborock_s8_pro_ultra_last_clean_end
|
entity_id: sensor.roborock_s8_pro_ultra_last_clean_end
|
||||||
- platform: state
|
- platform: state
|
||||||
|
id: vacuum_state_changed
|
||||||
entity_id: vacuum.roborock_s8_pro_ultra
|
entity_id: vacuum.roborock_s8_pro_ultra
|
||||||
- platform: state
|
- platform: state
|
||||||
|
id: vacuum_finished_cleaning
|
||||||
|
entity_id: vacuum.roborock_s8_pro_ultra
|
||||||
|
from: "cleaning"
|
||||||
|
for: "00:00:10"
|
||||||
|
- platform: state
|
||||||
|
id: roborock_automation_ran
|
||||||
entity_id:
|
entity_id:
|
||||||
- automation.roborock_smart_cleaning_start
|
- automation.roborock_smart_cleaning_start
|
||||||
- automation.roborock_syd_workday_vacuum
|
- automation.roborock_syd_workday_vacuum
|
||||||
- automation.roborock_syd_workday_mop
|
- automation.roborock_syd_workday_mop
|
||||||
attribute: last_triggered
|
attribute: last_triggered
|
||||||
- platform: time_pattern
|
- platform: time_pattern
|
||||||
|
id: fallback_refresh
|
||||||
hours: "/2"
|
hours: "/2"
|
||||||
sensor:
|
sensor:
|
||||||
- name: "Roborock Last Clean End Compact"
|
- name: "Roborock Last Clean End Compact"
|
||||||
unique_id: roborock_last_clean_end_compact
|
unique_id: roborock_last_clean_end_compact
|
||||||
state: >
|
state: >
|
||||||
{% set raw = states('sensor.roborock_s8_pro_ultra_last_clean_end') %}
|
{% if trigger.id == 'last_clean_end_changed' and trigger.to_state is not none %}
|
||||||
|
{% set raw = trigger.to_state.state %}
|
||||||
|
{% else %}
|
||||||
|
{% set raw = states('sensor.roborock_s8_pro_ultra_last_clean_end') %}
|
||||||
|
{% endif %}
|
||||||
{% if raw in ['unknown', 'unavailable', '', none] %}
|
{% if raw in ['unknown', 'unavailable', '', none] %}
|
||||||
Ukendt
|
Ukendt
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set dt = as_datetime(raw) %}
|
{% set dt = as_local(as_datetime(raw)) %}
|
||||||
{% if dt is none %}
|
{% if dt is none %}
|
||||||
Ukendt
|
Ukendt
|
||||||
{% elif dt.date() == now().date() %}
|
{% elif dt.date() == now().date() %}
|
||||||
|
|||||||
Reference in New Issue
Block a user