Add day of the week to a bar card

I have created an allergy view using “bar card” from HACS. I’m really happy with the way it has turned out, but I am curious if anyone knows: Is it possible to replace the generic “Today” with some sort of template/variable that will instead show the actual day of the week that today is (ie: Wednesday)? Similar question for the rest of the 5 days. So instead of “Today”, “Tomorrow”, “Day 3”, etc. it would show “Wednesday”, “Thursday”, “Friday”, etc. And then automatically update at midnight.

Mold

type: custom:bar-card
entities:
  - entity: sensor.mold_pollen_0d
    name: Today
  - entity: sensor.mold_pollen_1d
    name: Tomorrow
  - entity: sensor.mold_pollen_2d
    name: Day 3
  - entity: sensor.mold_pollen_3d
    name: Day 4
  - entity: sensor.mold_pollen_4d
    name: Day 5
title: Mold
direction: up
height: 100px
stack: horizontal
severity:
  - color: Green
    from: 0
    to: 6499
  - color: Yellow
    from: 6500
    to: 13999
  - color: Orange
    from: 13000
    to: 49999
  - color: Red
    from: 50000
    to: 1000000
min: 0
max: 100000
animation:
  state: 'on'
  speed: 2
1 Like

{{ (now()+timedelta(days=1)).strftime('%A') }}

%A will give full day, %a will give the three first letters.

2 Likes

I put this code into the Template editor under Developer tools, and it works great. However, when I put it into my card, replacing

- entity: sensor.mold_pollen_0d
    name: Today

with

- entity: sensor.mold_pollen_0d
    name: {{ (now()+timedelta(days=0)).strftime('%A') }}

I get the [object Object] error

What am I missing?

The card might not support templating.

1 Like

Alright. Thanks for your help

Posting for posterity. Templating works if you put the bar-card into a config-template-card. Then Ildar_Gabdullin pointed out that config-template-card requires the use of JS, not jinja. I posted the final working code and a screenshot of the card here.

Hi Brice, it’s not really a project that you share so your post is not marked with the right category