Hi
I don’t understand why it throwing an error while the template works? Am I missing something?
Template (because I’m only looking after the date, not the timestamp): {{ states('sensor.strava_0_0') | as_timestamp | timestamp_custom('%Y-%m-%d') }}
the sensor that the template uses:
but I’ve got errors like this: homeassistant.exceptions.TemplateError: ValueError: Template error: as_timestamp got invalid input 'unavailable' when rendering template '{{ states('sensor.strava_0_0') | as_timestamp | timestamp_custom('%Y-%m-%d') }}' but no default was specified
At some point The strava sensor was unavailable. That is when the error was generated. You need to supply a default value for your as_timestamp filter to prevent this happening.
you mean adding a default like this? {{ states('sensor.strava_0_0') | as_timestamp(default) | timestamp_custom('%Y-%m-%d') }}
or like this? {{ states('sensor.strava_0_0') | as_timestamp | timestamp_custom('%Y-%m-%d', 0) }}
hmm this one also works (not sure if it solves the issue though but in the template tester it is OK) {{ states('sensor.strava_0_0') | as_timestamp(default) | timestamp_custom('%Y-%m-%d', 0) }}
but to be honest I don’t know the actual difference between them and which one to use.