From 54b087ec8d1059fcec8014ac1a6d9369b147909d Mon Sep 17 00:00:00 2001 From: jumping2000 Date: Fri, 8 Sep 2023 21:37:07 +0200 Subject: [PATCH] fix dryer time left --- .../packages/elettrodomestici/dryer.yaml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/elettrodomestici_2023/packages/elettrodomestici/dryer.yaml b/elettrodomestici_2023/packages/elettrodomestici/dryer.yaml index 887e39a..6255684 100644 --- a/elettrodomestici_2023/packages/elettrodomestici/dryer.yaml +++ b/elettrodomestici_2023/packages/elettrodomestici/dryer.yaml @@ -272,6 +272,26 @@ availability: > {{ states('input_number.asciugatrice_runtime') not in ['unavailable', 'unknown', 'none'] }} + - name: dryer_time_left + state: > + {% set timer = ((states.input_datetime.asciugatrice_time_end.attributes.timestamp - as_timestamp(now())) / 60 ) | round(0) | default(1) %} + {% if states('sensor.dryer_status') != 'Idle' %} + {{ timer if timer>0 else 0 }} min + {% else %} + {% set program = states('input_select.asciugatrice_program') | default("Off") %} + {% set dict_time_program = { + 'Daily': '00:45:00', + 'Lana':'01:10:00', + 'Risparmio': '00:30:00', + 'Sintetici': '00:20:00', + 'Relax': '00:15:00', + 'Accappatoi': '00:40:00', + 'Off': '00:00:00' } %} + {{ dict_time_program[program] if program in dict_time_program else '00:00:00'}} + {% endif %} + availability: > + {{ states('input_datetime.asciugatrice_time_end') not in ['unavailable', 'unknown', 'none'] }} + - name: asciugatrice_modulo_manutenzione state: > {%- set value1 = states('counter.cicli_asciugatrice') |int(default=0) -%} @@ -309,26 +329,6 @@ availability: > {{ states('counter.cicli_asciugatrice') not in ['unavailable', 'unknown', 'none'] }} - - name: dryer_time_left - state: > - {% set timer = ((states.input_datetime.asciugatrice_time_end.attributes.timestamp - as_timestamp(now())) / 60 ) | round(0) | default(1) %} - {% if states('sensor.dryer_status') != 'Idle' %} - {{ timer if timer>0 else 0 }} min - {% else %} - {% set program = states('input_select.asciugatrice_program') | default("Off") %} - {% set dict_time_program = { - 'Daily': '00:45:00', - 'Lana':'01:10:00', - 'Risparmio': '00:30:00', - 'Sintetici': '00:20:00', - 'Relax': '00:15:00', - 'Accappatoi': '00:40:00', - 'Off': '00:00:00' } %} - {{ dict_time_program[program] if program in dict_time_program else '00:00:00'}} - {% endif %} - availability: > - {{ states('input_datetime.asciugatrice_time_end') not in ['unavailable', 'unknown', 'none'] }} - ################################################################# # # # UTILITY METER #