How do I use input_number in hours_to_show in a history graph card?

I created a helper entity input_number (input_number.hours_to_display) and added as a slider to a dashboard. I’m trying to use the input of this value in hours_to_show to adjust how many hours are shown in the history-graph card so I can adjust on the fly directly on the dashboard. Adding a state on the constant as I’ve done below doesn’t seem to work. Tried a couple things. What am I doing wrong here? Thanks in advance!

Input Slider Card:

History Graph Card showing the input.number entity used in hours_to_show

type: history-graph
entities:
  - entity: light.back_deck_lights
  - entity: light.back_deck_sconces
grid_options:
  columns: full
hours_to_show: "{{ states('input_number.hours_to_display') }}"

The majority of core cards do not support templating.

You may be able to accomplish your goal with a custom component like Card Mod or Card Templater.

1 Like

Card-mod cannot do it, probably config-template-card was meant instead.
Also, auto-entities card may be used as well.

2 Likes

Or you can use custom history explorer card instead, it natively supports selection of time span of the chart. E.g. it has built in UI selector, that allows to change how many hours/days/months is displayed, so no need to use helper.

1 Like