Dynamic parameter in lovelace config

hello everyone

I Use minigraph plugins and I would like put a dinamyc parameter to an option by example for this config:

                - color_thresholds_transition: smooth
                  entities:
                    - entity: sensor.humidity_exterieur
                      name: humidity exterieur
                      index: 0
                  font_size: 100
                  group: false
                  hour24: true
                  hours_to_show: 24
                  line_width: 6
                  points_per_hour: 1
                  show:
                    extrema: false
                    fill: fade
                    labels: true
                    name: true
                    state: true
                  type: 'custom:mini-graph-card'

I would like set the option “hours_to_show” with a input_number
can doing this in lovelace config file?

I have try with

hours_to_show: {{ states('input_number.days_to_show_temp_graph')|int *24 }}

but don’t seem working

Templates are not supported everywhere by default. But there are options.

seem doesn’t work with mini graph I have put this in my config maybe can I have done a mistake somewhere;

type: 'custom:config-template-card'
variables:
  - 'states[input_number.days_to_show_temp_graph''].state'
entities:
  - input_number.days_to_show_temp_graph
card:
  color_thresholds_transition: smooth
  entities:
    - entity: sensor.pressure_chambre
      index: 0
      name: pressure chambre
  font_size: 100
  group: false
  hour24: true
  hours_to_show: '${vars[0] * 24}'
  line_width: 6
  points_per_hour: 1
  show:
    extrema: false
    fill: fade
    labels: true
    name: true
    state: true
  type: 'custom:mini-graph-card'

I’ve never used this card, but the quotes are clearly wrong, a quick look at the examples on github suggest


variables:
  - states[ ’input_number.days_to_show_temp_graph‘ ].state

indeed after this correction it’s working thanks :sweat_smile:

1 Like

it’s amazing how many times it’s down to wrong quotes used and how many wrong options are available.
perhaps it’s something that has a great room for improvement?

Awesome, had exactly the same use case with graphs - works a treat!!