Trying to set max for custom:bar-card with a sensor value

I’m trying to implement the corona sensor.
I want to set the max for the bar cards to the biggest number instead of a static number.
But I can’t seem to use a template to set the max for the graph to work:

cards:
  - card:
      max: '{{ states(''sensor.worldwide_coronavirus_confirmed'') | int }}'
      min: 0
      padding: 2px
      title_position: inside
      type: 'custom:bar-card'
      width: 100%
    filter:
      include:
        - entity_id: '*worldwide_coronavirus*'
    type: 'custom:auto-entities'
  - card:
      max: '{{ states(''sensor.denmark_coronavirus_confirmed'') | int }}'
      min: 0
      padding: 2px
      title_position: inside
      type: 'custom:bar-card'
      width: 100%
    filter:
      include:
        - entity_id: '*denmark_coronavirus*'
    type: 'custom:auto-entities'
type: vertical-stack

This gave this result:

image

:frowning:

1 Like

it’s unlikely this will work. Generally you cannot add templating to lovelace
On the basis this is for a custom card, you would probably be better off raising this on the custom card owner’s github page…