Dynamic value in progress bar not working

Hello,

I’m trying to have this code for a custom:bar-card to work, as I want to have the max attribute be dynamic according to each file printed, so the progress bar reacts accordingly.
I’m aware that the card does not accept a string, but just a number so I though maybe I can circumvent the card restrictions with just a little template.

It does not work.

Is there a way to make this work?

entities:
  - entity: sensor.bambu_p1s_current_layer
    name: Current Layer
    max: ${states["sensor.bambu_p1s_total_layer_count"].state}
type: custom:bar-card

Thank you in advance

This part seems to be taken from a “bar-card inside config-template-card” example. Find an origin of your code & try to reproduce it fully.

1 Like

I understand that the feature I wanted was removed in Version 3.0 of the card (why? it was so simple, @Gluwc )

i had to use this code instead, I hope it will help someone in the future

type: custom:config-template-card
entities:
  - sensor.bambu_p1s_current_layer
  - sensor.bambu_p1s_total_layer_count
card:
  type: custom:bar-card
  entity: sensor.bambu_p1s_current_layer
  max: ${{states["sensor.bambu_p1s_total_layer_count"].state}}
  name: Layer status