I am currently testing some code to get a daily min and max values from a temperature
sensor. Together with the min max values, a time stamp should be generated as well e.q. when was the min max value generated.
Did not yet find a proper solution, but I am sure, I am not the first one with such a request.
Does anybody has some advise/code which is working for this?
You could have a input_number and two automations.
One that at midnight sets the input_number.max to -99 or something, and another automation that triggers when the current temperature is higher than max, then it updated the max number.
Then you would need the same setup for min except the midnight reset has to set min to 99, but it can do both min and max in the same automation.
So three automations in total.
Have a look at this. It satisfies your mean/max and time frame needs.
Maybe not the timestamp part.
As for the timestamp part, with a bit of effort you can probably export the values and their timestamp directly from your database, using the sql sensor.
I’m looking for the same thing and am actually surprised this is not available. I might go about this with some appdaemon code.
Basically at midnight
Max = current value
Min = current value
The max min integration does it not provide a moving min or max based on all provided entities?
I wrote my own daily max min custom component with daily reset. It does although not keep track of timestamps. GitHub - philsson/HomeAssistantCustomComponents
How did you install it? Did you copy the daily_min_max folder to the custom_components folder?
Interesting integration you linked to. It seems to do the same as mine but with some extra features as sum, average (mean), median, standard deviation and variation. On top of that they have the reset function which I actually just added to my component today. What mine has that this one does not is the ability to set another time other than midnight.
Hi there. I tested now your integration not for a while. I really like the possibility to have several functions in one integration. I am using Min, Max und Mean. In general the integration works great!
Suggestions and Questions:
What type of Mean is it using? It would be nice if it would be possible to choose between mean, average_linear and average_step like in the statistics-platform: Statistics - Home Assistant
It really would be great to have the option to reset everything at a certain time, not only at midnight. So I will try the integration @philsson for that function.
Is there an option to change the entities values later (e.g. the refresh-interval)? If not, a feature to change it later would be really awesome. As I am playing around I always had to delete the old ones, and create new ones, only if I want to try which refresh-interval is the best for my sensor.
Hi. What type of trigger automation should that be when the temp is higher than min. Wait for input or other type of trigger. I’m new to HA so that iscwhy I’m asking.
Hi.
I manage to get the daily min temp sensor reset daily to -99. But I do not know how to check the current temp is higher than the daily sensor. Can you give me an example
Thanks. Got it to work now. Have one more struggle and that is the strftime formatting is not working.
I use the following code for the time stamp of the temperatures.
It gives me the correct time stamp but the formatting is ignored. For instance %m should result in a month number and not text, right? But that is not working