Untitled
unknown
plain_text
2 years ago
1.4 kB
35
Indexable
- name: "Washing Remain Percent"
unique_id: "sensor.geschirrspuler_remaining_program_time"
state: >
{% if state_attr('sensor.geschirrspuler_remaining_program_time', 'remain_time') == '0:00:00' %}
0
{% else %}
{%- set start = state_attr('sensor.geschirrspuler_remaining_program_time', 'initial_time') -%}
{%- set end = state_attr('sensor.geschirrspuler_remaining_program_time', 'remain_time') -%}
{%- set start_h = as_timestamp(strptime(start, '%H:%M:%S', '00:00:00')) | timestamp_custom("%H") | multiply(60) | round() -%}
{%- set start_m = as_timestamp(strptime(start, '%H:%M:%S', '00:00:00')) | timestamp_custom("%M") | round() -%}
{%- set start_s = ((as_timestamp(strptime(start, '%H:%M:%S', '00:00:00')) | timestamp_custom("%S") | int) / 60) | round(1) -%}
{%- set end_h = as_timestamp(strptime(end, '%H:%M:%S', '00:00:00')) | timestamp_custom("%H") | multiply(60) | round() -%}
{%- set end_m = as_timestamp(strptime(end, '%H:%M:%S', '00:00:00')) | timestamp_custom("%M") | round() -%}
{%- set end_s = ((as_timestamp(strptime(end, '%H:%M:%S', '00:00:00')) | timestamp_custom("%S") | int) / 60) | round(1) -%}
{%- set initial = start_h + start_m + start_s -%}
{%- set consumed = initial -(end_h + end_m + end_s) -%}
{{ 100 - ((consumed/initial)*100) | round() }}
{% endif %}Editor is loading...
Leave a Comment