But i can’ show cycles per hour, in statistics card “stat types” i can’t choose state or change option… So i see only increasing values.
How can i visualise only per hour changes ?
Yeah, that doesn’t seem right. Maybe post your YAML here. Usually when I get a result like that it’s something stupid I did, like a typo in the event ID, or just looking at the wrong entity. Those are the hardest to find. Sometimes going away for a while and coming back later with a fresh outlook makes it jump out at me.
Unfortunately “change” or “state” options unavailable from stats card configuration - it’s greyed out.
That’s why i’m stucked)
And History Graph is totally different - it doesn’t represent “per hour cycles”.
Ok you can only use change with state_class: total (or total_increasing). But forget that.
Looking again at your graph it is working fine. From 3am to 4am it turned on 9 times. And that is what your graph shows at 4am. Remember you defined it as now minus one hour:
end: "{{ now() }}"
duration:
hours: 1
So the 4am bar is for 3am to 4am.
For 4am to 5am the count was 0. And that is what shows for the 5am bar, at least I think it does it is hard to see behind the tool tip.
ooohhh… i think i got the main idea…
But can’t we just say something like “beginning of each hour” with some templating ? and duration 1 hour ?
Or why it’s impossible to make smth like this ?
If you replace end with start in Tom’s template you’ll get closer to real-time updates. The counter should increase within a minute of a state change, and it should reset to zero or 1 (see below) within a minute after each new hour.
A peculiarity of the history_stats count method is that it is NOT a “rising edge” counter. Instead it counts the number of times the device has been in the desired state during that time window. In other words, if you are counting on states, and the device was alreadyon at the start of the window, the counter will count that as 1, even though there is no rising edge. That is important because if the pump is already running when a new hour starts, you’ll get a count of 1 added in the previous hour and a count of 1 added in the new hour, even though the pump only turned on once.
If you want a rising edge counter that updates immediately upon state changes and returns to zero immediately at the start of every hour, then the only option is a trigger-based template sensor with some fancy templates.
If the peculiarities of the history_stats don’t bother you, then there’s no need to go down that path.
To be honest i’ve started this “investigaion” after i’ve made up garden water output and started changing my water pressure tank and relay settings for maximum capacity (minimising water pump starts/stops).
So +/- 1 start/stop isn’t pain in the ass…
But last template sems to works strange as well…