History-graph: using float "hours_to_show"

For some time the “history-graph” card allowed to use only integer values for “hours_to_show”.
Till this moment UI editor only allows to select integer values (>= 1).

A few months ago I realized (may be it happened some time earlier) that “history-graph” accepts float values for “hours_to_show” - even <1:

I found this change very useful, it allowed scenarios like:
– see a graph for a small period (less 1 hour);
– see a graph from “00:00” this day (with a help of “config-template-card”).

here is a code for CTC
type: custom:config-template-card
entities:
  - sun.sun
card:
  type: history-graph
  entities:
    - sun.sun
  hours_to_show: >-
    ${
      var date = new Date();
      var curHour = date.getHours() + date.getMinutes()/60.0;
      curHour
    }

But UI still allows to select integer values only.

I made this issue to change UI correspondingly:

Possible ways:
– Dev team will disable a possibility of using float values;
– Dev team will make using float values “officially” - i.e. corr. changes are made in Docs, UI allows to select float values.

I wonder how many users here interested in the 2nd way?
Can users ASK developers not to disable float interval (i.e. hence not to choose 1st way)?

1 Like

I am afraid that this possibility to define fractional “hours_to_show” (which I consider as a really useful improvement) may be declared as a bug.

Seems that I am the only person who is interested in this functionality in a conventional card.

Update: probably the “hours_to_show” parameter (which is currently officially an integer) will be replaced by a “duration” (I hope it will include minutes). Then there is a hope ))).

Update 05.12.24: with this merged PR it is allowed to input a float value into “hours_to_show” field.

1 Like