Page 1 of 1

JSON temperature range day returns 3 days

Posted: Wednesday 23 November 2022 15:47
by buxol
Hi,

I need the last 24h to calculate the average temp for the day.
But using JSON as below gives me the last three days (like the graph) but I only want the last day (24h).

http: //127.0.0.1/json.htm?type=graph&sensor=temp&idx=100&range=day

Please advise,
Kind regards,
Roel

Re: JSON temperature range day returns 3 days

Posted: Wednesday 23 November 2022 16:31
by willemd
Have a look at this thread
viewtopic.php?p=292574#p292574

Re: JSON temperature range day returns 3 days

Posted: Wednesday 23 November 2022 20:49
by buxol
@Willemd, I looked at the thread, but I did not find any information about filtering the last 288 values from the total of 864 values you get from the JSON. Thanks anyway.

Re: JSON temperature range day returns 3 days

Posted: Wednesday 23 November 2022 21:48
by waltervl
That command with day is used to create the day log graph and if you have set that for 3 days in the settings you will get 3 days of data. So an option would be to set the setting to 1 day or else do the filter for 1 day in the program you use to calculate the average of today (or the last 24 hours?). There are time stamps for each value so that should be possible.

Re: JSON temperature range day returns 3 days

Posted: Wednesday 23 November 2022 21:55
by waltervl
Additional you can use DzVents with persistent data function.
For script examples search the forum for "history = true"


https://www.domoticz.com/wiki/DzVents:_ ... les_API.29

Re: JSON temperature range day returns 3 days

Posted: Thursday 24 November 2022 15:01
by buxol
I found the for-loop in the script that cycles through the data and customized the loop to start at 577 instead of 1, in order to bypass the first two days.
A bit quick and dirty, but it works.

Re: JSON temperature range day returns 3 days

Posted: Thursday 24 November 2022 16:26
by waltervl
Yes, there is always a way... ;)