This commit is contained in:
2023-07-15 01:04:33 +02:00
parent 900f180c69
commit 139a655400
41 changed files with 479 additions and 127 deletions

0
packages/laundry/laundry_timer.yaml Executable file → Normal file
View File

29
packages/laundry/timer.yaml Executable file → Normal file
View File

@ -1,3 +1,30 @@
timer:
laundry:
#duration: "03:20:00"
#duration: "03:20:00"
sensor:
- platform: template
sensors:
laundry_remaining:
friendly_name: "Laundry Remaining"
value_template: >
{% set f = state_attr('timer.laundry', 'finishes_at') %}
{{ '00:00:00' if f == None else
(as_datetime(f) - now()).total_seconds() | timestamp_custom('%H:%M:%S', false) }}
template:
- trigger:
- platform: state
entity_id:
- timer.laundry
attribute: remaining
sensor:
# Keep track how many days have past since a date
- name: laundry_remaining
state: >
{% set f = state_attr('timer.laundry', 'finishes_at') %}
{% set res = '00:00:00' %}
{% if f != None %}
{{ (as_datetime(f) - now()).total_seconds() | timestamp_custom('%H:%M:%S', false) }}
{% else %}
{{ res }}
{% endif %}