Hi,
I'm slowly starting to learn DzVents and using it for extra functions, but run into questions on how to solve things.
So now, this is my situation:
I have built a DzVents script that needs to calculate the average power from my Solar-system every minute, over the last 3 or 5 minutes, to activate or stop the charging my car.
I have got this working by storing the values of the Domoticz Electricity device in a (global) persistent variable with history, and then use the "avgSince" function to get the average. That works fine.
However: I was wondering: the Domoticz Electricity Device is already logging the history of the actual power in the Domoticz database. It therefore seems redundant to store the (short term) history as wel in the DzVents persistent variable.
Is there a way to get the historic values of the Electricity Device from the Domoticz database in DzVents for use in the avgSince calculation? I couldn't find that in the documentation or in this forum.
How to access historical sensor data?
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: How to access historical sensor data?
You can get the historic values of the Electricity device using the APIBikey wrote: Thursday 11 June 2020 14:54 Is there a way to get the historic values of the Electricity Device from the Domoticz database in DzVents for use in the avgSince calculation? I couldn't find that in the documentation or in this forum.
Code: Select all
http://<domoticz IP: domoticz port>/json.htm?type=graph&sensor=counter&idx=<device idx>&range=day
You cannot use this data in the avgSince function because this function it tailor made for the timeSince format in persistent historical data.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
Bikey
- Posts: 331
- Joined: Sunday 22 February 2015 12:19
- Target OS: Linux
- Domoticz version: 2020.x
- Location: Netherlands
- Contact:
Re: How to access historical sensor data?
Ah, thanks, for the tip.
The granularity of 5 minutes is too coarse for my use case, so I will stick to using the DzVents persistent variable then and the easy use of the statistical functions!
The granularity of 5 minutes is too coarse for my use case, so I will stick to using the DzVents persistent variable then and the easy use of the statistical functions!
Who is online
Users browsing this forum: No registered users and 1 guest