I have a sensor that can go “on” (+ other states) and “off”. I would like to count how often the sensor switch from “on + other states” to “off” every day.
What i understand from the documentation:
First I need history_stats type: count with state “off” and then a utility_meter with cycle: daily,weekly etc. for the statistics.
I am blind (or sloppy…take a pick)…yes this is how it could work.
The utility meter sensor will just show a growing figure during the day…so depends a bit what you want to do with the data
That should work I guess, depends on what you want to do with the data. Using utility meter you at least have it in (longterm) statistics. Either way, there is no harm in trying it out and see what it does
First idea was something similar to the energy board.
Filter for day, month or year and then show a Chart.
Have not so much experience with charts, but this could do the job maybe ApexCharts card - A highly customizable graph card
Nope, you’d have to check this via the ‘history’ of the sensor, they should remain wiht their old state. templet sensors may go to blank, depends on how you set that up
Again, what does the history of sensor.wp_status show…if this goes to Aus after restart then this is the source of the issue, maybe you can control that sensor?
I get the value from a html site with scrape.
Then i translate the value to an status:
like
value == 0 → Aus
value == 1 → An
value == 2 → Other State etc.
etc.
So yes i have both sensor “under” control. But not sure what is the status for the restart and the initial value. IMHO the last state is Aus and after restart is also Aus. So no state change
Use the history of the sensor? Check logbook or history from the left menu item before+after the last restart. If it indeed comes up with ‘Aus’ then this may be fhe issue, I donot exactly know how hsi_stats counts but I think the sensor starts with ‘blank’ and then goes to last value…only one able to check this is you
What is the value of the sensor shortly befor emidnight? If that is not 0.0 then I guess it would start with 0, if it is 0.0 then it would start with 1…but to be 100% honest, the details on a restart of a history stats sensor is not fully transparent to me.
You could try it out with a different start (during daytime) and manually update the sensor to see what it does
what I (me) would expect
23:59 state: 0.0
00:00 wp taktung: 1
why: it restarts, finds value 0.0 so 1
with similar thoughts:
23:59 state: 0.1 (not 0.0)
00:00 wp taktung: 0
However, it could also be that the reset at midnight means to start from 0 and only after it re-hits 0.0. then it starts counting
@Mariusthvdb
Of course I can do it myself with more effort. I would still be interested why it does not work, what it is intended for.
As it works 99% of the days I would say the value is 0.0 at 23:59.
Can I see the different value in the logbook? Currently it’s pretty easy, the value changes at 11 am o’clock from 0.0 to 0.4
and at 11:30 am o’clock from 0.4 to 0.0.
So it should currently always be 1. Which it usually does, but sometimes it’s two, which makes no sense at all.