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
JSON temperature range day returns 3 days Topic is solved
Moderator: leecollings
-
- Posts: 661
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: JSON temperature range day returns 3 days
Have a look at this thread
viewtopic.php?p=292574#p292574
viewtopic.php?p=292574#p292574
-
- Posts: 13
- Joined: Friday 01 January 2016 23:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: JSON temperature range day returns 3 days
@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.
- waltervl
- Posts: 5906
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: JSON temperature range day returns 3 days
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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- waltervl
- Posts: 5906
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: JSON temperature range day returns 3 days
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
For script examples search the forum for "history = true"
https://www.domoticz.com/wiki/DzVents:_ ... les_API.29
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 13
- Joined: Friday 01 January 2016 23:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: JSON temperature range day returns 3 days
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.
A bit quick and dirty, but it works.
- waltervl
- Posts: 5906
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: JSON temperature range day returns 3 days
Yes, there is always a way... 

Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Who is online
Users browsing this forum: No registered users and 1 guest