Hello,
I would like to extract my 5 minute P1 E readings from Toon and my hourly P1 G readings from Toon out of the domoticz.db so I can back them up in a detail database.
Not sure which tables to use for this... Any hints?
Or is this also extractable through the JSON i/f? my Toon P1 E sensor id =11, my G sensor id =12...
any help appreciated.
G.
extract 5 minute Toon data from domoticz.db
Moderators: leecollings, remb0
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: extract 5 minute Toon data from domoticz.db
You could try dzVents and have it collect 5 minutes worth of samples using a 'historical variable'. Combine this with a script that runs every 5 minutes and you could serialize it to some other system. All in a Lua script. Takes you just a few lines of code. That way you don't need low-level db access.
Something like this:
Something like this:
Code: Select all
return {
active = true, -- set to true to activate this script
on = {
'myToonDevice',
['timer'] = 'every 5 minutes',
},
data = {
energyReadings = { history = true, maxMinutes = 5 }
},
execute = function(domoticz, toon, triggerInfo)
if (triggerInfo.type == domoticz.EVENT_TYPE_DEVICE) then
-- toon was updated, add the reading to the data set
domoticz.data.energyReadings.add(toon.utility) -- holds the current reading
else
-- timer event was triggered
-- so 5 minutes has passed
-- at this point you can do something with the historical data
domoticz.data.energyReadings.forEach(function(watt)
-- collect
end)
-- save it somewhere
-- reset the readings for the next 5 minutes
domoticz.data.energyReadings.reset();
end
end
}
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Who is online
Users browsing this forum: No registered users and 1 guest