Skip to content

Local time format #925

Closed Answered by dt215git
kwithus asked this question in Q&A
Apr 27, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

I think you need to convert value.date.strftime("%w") to an integer in order to access the list. Perhaps something like this

- platform: waste_collection_schedule
  name: TempName  # change this to something else
  details_format: appointment_types
  value_template: >
    {% set weekdays = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] %}
    {% set day = value.date.strftime("%w") | int %}
    {% set binday = weekdays[day] %}
    {{value.date.strftime("%A")}} | {{value.daysTo}} | {{value.types|join(", ")}} | {{day}} | {{binday}}
  add_days_to: true

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kwithus
Comment options

@dt215git
Comment options

Answer selected by kwithus
@kwithus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants