kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.89k stars 233 forks source link

Support templating ? #979

Closed ceinmart closed 1 year ago

ceinmart commented 1 year ago

Hi,

I have this code:

type: custom:mini-graph-card
name: Consumo energia da Casa
align_icon: left
hour24: true
points_per_hour: 8
aggregate_func: max
line_width: 1
lower_bound: 0
hours_to_show: 12
entities:
  - entity: sensor.disjuntor_geral_power
  - color: gray
    entity: sensor.consumo_energia_da_casa_diario
    name: Consumo do dia
    show_line: false
    y_axis: secondary
    graph: bar
show:
  show_points: false
  labels_secondary: true
  labels: true
  points: hover
view_layout:
  grid-area: cab2

I'm trying to make the parameter hours_to_show dynamically , to show only the hours of the current day using this code:

hours_to_show: '{{ now().hour }}'

But it's not working. Show no graph As far goes my knowledge about templating, that should work didn't ? My system is set to 24h format, so , they always should exibith the data from mid-night ...

or I'm missing something here?

Working image

not working... image

ildar170975 commented 1 year ago

Read docs - it is not written that the card does support templating.

You may start following this FR: https://github.com/kalkih/mini-graph-card/issues/697

If you need to show data for "today" - try using a code from here