hassio-conf/templates/roborock.yaml
2024-10-17 21:45:45 +02:00

54 lines
2.1 KiB
YAML

- sensor:
- name: valetudo_rockrobo_main_filter_duration
state: >-
{% set minutes = states("sensor.valetudo_rockrobo_main_filter") | int(0) %}
{% set hours = ((minutes % 1440) / 60) | int %}
{% set days = (minutes / 1440) | int %}
{%- if minutes >= 60 -%}
{%- if days > 0 %}{{ days }}d{% endif -%}
{%- if hours > 0 -%}
{{ ' ' + hours | string if days > 0 else hours }}h
{%- endif -%}
{%- else -%}
{{ minutes }}min
{%- endif -%}
- name: valetudo_rockrobo_right_brush_duration
state: >-
{% set minutes = states("sensor.valetudo_rockrobo_right_brush") | int(0) %}
{% set hours = ((minutes % 1440) / 60) | int %}
{% set days = (minutes / 1440) | int %}
{%- if minutes >= 60 -%}
{%- if days > 0 %}{{ days }}d{% endif -%}
{%- if hours > 0 -%}
{{ ' ' + hours | string if days > 0 else hours }}h
{%- endif -%}
{%- else -%}
{{ minutes }}min
{%- endif -%}
- name: valetudo_rockrobo_main_brush_duration
state: >-
{% set minutes = states("sensor.valetudo_rockrobo_main_brush") | int(0) %}
{% set hours = ((minutes % 1440) / 60) | int %}
{% set days = (minutes / 1440) | int %}
{%- if minutes >= 60 -%}
{%- if days > 0 %}{{ days }}d{% endif -%}
{%- if hours > 0 -%}
{{ ' ' + hours | string if days > 0 else hours }}h
{%- endif -%}
{%- else -%}
{{ minutes }}min
{%- endif -%}
- name: valetudo_rockrobo_sensor_duration
state: >-
{% set minutes = states("sensor.valetudo_rockrobo_sensor_cleaning") | int(0) %}
{% set hours = ((minutes % 1440) / 60) | int %}
{% set days = (minutes / 1440) | int %}
{%- if minutes >= 60 -%}
{%- if days > 0 %}{{ days }}d{% endif -%}
{%- if hours > 0 -%}
{{ ' ' + hours | string if days > 0 else hours }}h
{%- endif -%}
{%- else -%}
{{ minutes }}min
{%- endif -%}