Hm, apparently that does not work in my case.
For one, the entity_id option for template sensors seems to have been deprecated about a year ago (see here).
It’s still in the docs, so I tried it, but my sensor is not updating.
Then I was looking to find some info about this “sensor.time” sensor, but couldn’t find anything.
Putting {{ states("sensor.time") }} into /dev-template renders to “unknown”. Hm.
My template sensor looks like this:
platform: template
sensors:
bat_pronto:
value_template: >
{% if is_state_attr("device_tracker.pronto", "battery", "charging") %}
110
{% else %}
{{ state_attr("device_tracker.pronto", "battery") | int }}
{% endif %}
unit_of_measurement: '%'
with device_tracker.pronto having only two attibutes “battery” and “last_update” where the value of the latter is a time stamp that changes regularly.
I would like to update the template sensor at least each time the last_update value changes, so a new data point gets sent to InfluxDB.
Sebastian
EDIT: I also just noticed that adding “entity_id: sensor.time” completely prevents the template sensor from updating, i.e. after restarting HA its value stays “0” even if the device tracker updates its state.