Minutes until washing is done

I have a Samsung washing machine and from that, i get a sensor telling me when the machine is done. How can I create a template sensor show me how many minutes is left until its done? Today I get a sensor showing UTC time, state is 2020-10-08T15:59:37.332Z and I made a sensor show the time in local and removed date and second (state. 17:59)

I would like to have that to show on my tablet in natural text like “The washing machine is ready in 34 minutes, at 17:59”

Post what you have created and we can help you modify it so it displays the “natural text” you want.

This Is what I have now

 {% if is_state('switch.tvattmaskin', 'on') %}
  Washing machine is done at {{ as_timestamp(states.sensor.tvattmaskin_washer_completion_time.state) | timestamp_custom("%H:%M") }}{% endif %}

Using this sensor

Would like to add in how many minutes as well

Try this:

#sensor:
  - platform: template
    sensors:
      washing_machine:
        friendly_name: Washing Machine
        value_template: >
          {% if is_state('switch.tvattmaskin', 'on') %}
            {% set t = as_timestamp(states.sensor.tvattmaskin_washer_completion_time.state) %}
            {% set end = t | timestamp_custom("%H:%M") %}
            {% set duration = ((t - now().timestamp())/60) | round(0) %}
            Washing machine is done in {{duration}} minutes at {{end}}.
          {% else %}
            Washing machine is off.
          {% endif %}

It may need further enhancement to prevent reporting negative values if switch.tvattmaskin continues to indicate on even when the washing cycle is finished. If that happens then the message could say something like “Washing machine finished X minutes ago at YY:ZZ”. Or something like that; I don’t know how your washing machine reports all aspects of its operation via those two entities.

3 Likes

Thanks @123, that works great!

1 Like