Bar diagram - history sensor start end

I want to show a bar diagram using the mini graph card of a boiler state sensor in my ui.

I’d like to have one diagramm that shows one bar for each day and one that shows one bar for each hour.
So if it was on for 30 minutes between 5 and 6 a.m. it should show a 30 minutes bar (so max would be 60min) or a 50% bar.

How can I achieve this?

I thought of using a histroy stats sensor

- platform: history_stats
  name: Boiler runtime hourly
  entity_id: binary_sensor.boiler_state
  state: 'on'
  type: time
  start: '{{ now().replace(minute=0).replace(second=0) }}'
  end: '{{ now() }}'

But the issue with that if you look at it at let’s say 8:45 it will show you bars from 7:45 to 8:45. Not 7:00 to 8:00 …

I need help with this again. @petro @pnbruckner

Not true, if you peered at it @ 7:45, it would show you 7:00 to 7:45. It will never show you from 7:45 to 8 because that doesn’t exist yet.

I mean, you could attempt to use this

- platform: history_stats
  name: Boiler runtime hourly
  entity_id: binary_sensor.boiler_state
  state: 'on'
  type: time
  start: '{{ now().replace(minute=0).replace(second=0) }}'
  end: '{{ now().replace(hour=now().hour+1).replace(minute=0).replace(second=0) }}'

can’t say for certain that it will work.

You are right, I explained it wrong. The sensor would show from 7:00 to 7:45.
But in the bar diagram it takes the time now and than makes one hour bars.

So if I look at it on 7:45 it will show me …; 5:45-6:45; 6:45-7:45 bars. And of courese I’d like to have 5:00-6:00; 6:00-7:00 and 7:00-7:45

that still doesn’t make sense because you are replacing the start minute time with zero. The only explanation is that the display is incorrect and you are actually seeing 5-6 and so forth.

Ok, so I use the sensor I mentioned in my first post.

With the mini-graph-card and this in my lovelace config

  - type: custom:mini-graph-card
    entities:
      - entity: sensor.boiler_runtime_hourly
    name: Boiler runtime 
    show:
      graph: bar
    hours_to_show: 168
    points_per_hour: 1 

I get an output like this:

As you can see it shows me bars like 8:35-9:35 but I want to force it to show full hours (8:00 to 9:00). Independent on which time I look at the diagram.