Hi there, I have the following challenge. I have a sensor that is named sensor.traveltime, this contains my travel time to home in minutes. Becasue I want to show my arrival time on a dashboard, I created a custom sensor using this code:
- platform: template
sensors:
arrival_time:
value_template: '{{ (utcnow().strftime("%s") | int + state_attr("sensor.traveltime","duration") | int*60) | timestamp_custom("%H:%M:%S") }}'
friendly_name: 'Arrival Timel'
icon_template: "mdi:clock-time-four"
But this sensor doesn’t work that well, because the travel time only gets updated once every 5 minutes. But the arrival time sensor updates every time that utcnow changes. So the arrival time becomes 1 minute later every minute, untill travel time sensor is updated, and then arrival time becomes 5 minutes earlier again.
So bottom line, I only want the arrival time sensor to update, when the travel time changes. Is that possible? Do I need to use an automation maybe?