I have two methods of having hot water for my shower. The first is my electric shower, which is not relevant to my question, the other method is via my central heating.
When the heating is active, my hot water tank is heated as well, meaning that as long as the heating comes on in the morning and/or evening, I have a steady supply of hot water. This time of year though, as the weather gets warmer, there’s no guarantee that the heating will come on, due to the house being above the heating threshold, which means no hot water. (Obviously then I resort to the electric shower.)
What I’d like to do is for my system to keep a running track of the following.
Did the heating come on in the last 12 hours
Was it on for at least a half hour
My heating is controlled by Hive, and if I check the integration, yes I can see when it came on, but the point of this is that if I get up at 6am and wander half asleep into the bathroom, I don’t need to wonder if I need to switch to the electric shower or not. I’ll probably output the result to one of my Hue bulbs as a colour change, but that I can handle.
Obviously this is purely a convenience thing, and not essential, but I like the idea that it might also save me a little money, as the water heats by default if the heating is on anyway, but it’ll cost extra to use the electric shower.
Hopefully someone can point me in the right direction.
Aside above proposal, you can also try to populate a helper (input_boolean or something) when the heater is ‘on’ and use that…e.g. if heater=on for x minutes, set input_helper to 1/true…and add a second automation to trigger on that in the morning for your electric shower
I do agree though this is nitty gritty convenience stuff but nice to try
I’ve tried this and created a sensor, but it’s not working. I think I need to track the hvac_action attribute, but it keeps saying history stats doesn’t support attributes. It seems I’m going to have to create a template binary sensor first and then track that …
Then we create 3 more sensors which use the ‘‘History_stat’’ to grab the time the sensors has been in ‘‘Heat’’ mode, bare in mind this will only start from when the sensor is made, and will be incorrect if HA went down.
Not 100% if the yesterday is working yet as there is no data, will see tommorow
Below is a picture of my dashboard (using mushroom cards)
The drayton Wiser is a brilliant option as its instant via HA as working locally unlike ‘‘Hive’’ integration
little bit more complicated to setup
I tried to copy your sensors so i could track mine as well, but for some reason i am not getting any stats on the history_stats sensors. here is what i have as my attribute sensor.
they always show 0.0 on the stats, i would expect them to be showing some rolling total throughout the day. I am guessing i am missing something, but i can’t figure out what it is.
It looks different to mine, but I was only interested in 12 hour intervals.
# Keep track of how long the heating has been on.
- platform: history_stats
name: downstairs heating
entity_id: sensor.downstairs_hvac
state: "heating"
type: time
end: "{{ now() }}"
duration:
hours: 12
I think you can increase the hours to what you need.
let me try that and see if it works. i used a start and end time, but maybe it just needs an end and duration as you have specified. I’ll report if that fixes it.
Tried it, but it still shows 0.0 as the value. i don’t see any errors or anything in the logs. it’s almost like it can’t connect to history, but the history is there… i was reading the history_stats documentation and the examples they give are how i set up my time periods. i would think that should work. would the double quotes make a difference (just grasping at straws).
my issue was a dumb mistake on my side. On another thread they found and corrected my issue. the issue was with the sensor HVAC Activity Upstairs configuration. the solution is here: