Template Sensor stops working when the referenced sensor changes (I included entity_id!)

I use the following template sensor to calculate number of hours since my cat feeder was last run.

      dev_feeder_hours_since_fed:
        entity_id:
          - sensor.dev_feeder_last_fed
        value_template: >
          {% set time = as_timestamp(now()) - as_timestamp(states('sensor.dev_feeder_last_fed')) %}
            {{ (time / 3600) | round() }}

If I plug that into the template editor it gives me the correct value (at the moment that would be 5) – But the sensor itself reads 0.

More detail: After restarting home assistant the sensor works fine and reads the correct number of hours, but as soon as I feed the cat and the time value for sensor.dev_feeder_last_fed is updated with a new time, the sensor goes to 0 and stops updating itself after that. Just sits at 0 forever.

Any idea why it won’t update? My search for solutions yielded a lot of threads about last year’s breaking change requiring inclusion of entity_id in the template config. I’ve done that, but I’m wondering if I’ve done it wrong…?

now() does not trigger template updates. Assuming you have a time sensor, try:

      dev_feeder_hours_since_fed:
        entity_id:
          - sensor.dev_feeder_last_fed
          - sensor.time
        value_template: >
          {% set time = as_timestamp(now()) - as_timestamp(states('sensor.dev_feeder_last_fed')) %}
            {{ (time / 3600) | round() }}