Relative_time, last_changed and template sensor: No updates?

Despite this having not worked and then been supposedly been fixed in the past, I can’t get template sensors based on relative_time (or now() and as_timestamp()) to update. Does anyone know a workaround for this? Thanks!

Example for demonstration purposes: The output does not change unless the switch is toggled. The expectation would be that the number of passed seconds would be counting up (I don’t necessarily need it to update every second).

sensor:
  - platform: template
    sensors:
      test_update:
        value_template: "{{ relative_time(states.input_boolean.test_boolean.last_changed) }}"

Topic where this was discussed before and supposedly fixed:

Take a look here:

1 Like

Thank you! I haven’t gotten it to work in my bigger, real-world template yet, for some reason, but the below works, so this must be the key to it for sure.

{{ relative_time(states.input_boolean.test_boolean.last_changed) }}{{ states.sensor.time.state[0:0] }}

(Outputs last_changed with updates, by referencing sensor.time, but not outputting anything for it by way of a zero-length sub string.)