Template sensor no longer updating

I have a template sensor, that tells me how long my washing machine is running. Or rather I had until 0.115 changed templates. I read the breaking changes and the new part in the template sensor docs about the dummy with states.time. The template renders fine in the developer tools but the sensor stays at zero. What am I missing?

platform: template
    # entity_id: sensor.waschmaschine_leistung_average
    value_template: >-
      {% set dummy = states("sensor.time") %}
      Die Waschmaschine {% if is_state("binary_sensor.waschmaschine", "on") -%}
      läuft {% set zeit = (as_timestamp(now())-as_timestamp(states.binary_sensor.waschmaschine.last_updated)) / 60 %}
      {% if zeit < 60 -%}
      seit {{zeit | int}} Minuten.
      {%- else -%}
      seit {{ ( zeit / 60 ) | int }} Stunden, {{ ( zeit - ( ( zeit / 60 ) | int ) * 60 ) | int }} Minuten.
      {%- endif %}
      {%- else -%}
      ist aus.
      {%- endif %}

to clearify: in the developer tools it renders as

Die Waschmaschine läuft
seit 19 Minuten.

but the sensor value stays at

Die Waschmaschine läuft
seit 0 Minuten.

The time sensor only updates every minute. You previously updated this sensor with sensor.waschmaschine_leistung_average (I’m guessing based on the commented out entity_id), why not use that as your dummy item?

1 Like

I understand that the time sensor only updates once a minute, that would be often enough for the usecase. But the template sensor doesnt update at all.
You might be right though, I will try sensor.waschmaschine_leistung_average as my dummy.

it probably wasn’t updating because you don’t have sensor.time integrated into your system. When you use sensor.time as a dummy line, you also need date & time sensor integrated as well.

You’re absolutly right, I do not have Time&Date sensor configured. :sweat_smile: I kinda assumed that was some buildin component.