I’ve investigated the two options you suggested but in my case peharps the better solution for me is to write a lua code in the local VeraEdge to run periodically that read wsp file containing the power values (with a retention of one minute in a day) and calculate the energy (kwh) .
Have you a sample code to read a wsp file (I think in JSON format) and the single “datapoints” ? Can I use in lua (VeraEdge) a DY http call to render the wsp file in JSON ?
if I access the whisper file directly and I want to get the value from the start of the day until the time of run, is it correct if I use in the fetch call the time as os.time{hour=00, min=00} ?
No, that’s not a valid specification for time. If you’re talking about the current day, then you have to get the table for today, and modify the HH:MM:SS to zero, like this:
do you think is possible to have, for the same metric (for example Power-Watt), two different archive files with different storage schemas and aggregations.
At the moment I’ve defined two variables with the same value (Watt) in the Vera Controller and I’ve defined two storage schemas-aggregation in DY.
[ol][li]have multiple DataCache daemons running on different machines writing to different databases (perhaps not what you want)[/li]
[li]use the user-defined processing in DataWatcher (described here http://forum.micasaverde.com/index.php/topic,37119.msg278081.html#msg278081, and in the latest documentation) to generate multiple metric names for the given input[/li][/ol]
[ol][li]have multiple DataCache daemons running on different machines writing to different databases (perhaps not what you want)[/li]
[li]use the user-defined processing in DataWatcher (described here http://forum.micasaverde.com/index.php/topic,37119.msg278081.html#msg278081, and in the latest documentation) to generate multiple metric names for the given input[/li][/ol]
(2) is probably what you’re needing.
So yes, out-of-the-box you can do it today.[/quote]
Hi akbooer,
I’ve remote Veras with DataWatcher that send data to a centralized Rpi-Luup-DY via DataCache. Can I use L_DataUser on centralized Luup-DY or do I have to use it on remote Veras ?
In last case is it possible ?
[quote=“d55m14, post:49, topic:186813”]I’ve remote Veras with DataWatcher that send data to a centralized Rpi-Luup-DY via DataCache. Can I use L_DataUser on centralized Luup-DY or do I have to use it on remote Veras ?
In last case is it possible ?[/quote]
The user-defined processing works in DataWatcher, so the easiest approach is to have all the Veras doing the job. HOWEVER… as of a recent update, DataWatcher also acts as a proper relay for Whisper plaintext messages, so a possible configuration would be to run DataWatcher on your central RPi with your user-defined processing and have all the remote DataWatcher send their data to that, rather than directly to DataCache.
I’ve never set up this configuration myself, but then DataYours is so modular that there are lots of configurations I’ve never tried. Your have to set up this parameter on the central DataYours device variables:
LINE_RECEIVER_PORT = 2013
(2013 is the traditional value for this port.) You have to change the DESTINATIONS parameter in your remote device to include that port too.
I wonder if you’re able to try this out before setting it loose on your whole installation? Ask again if this is not clear. Maybe a picture will help?
May i have on the centralized luup DY either DataCache and DataWatcher active as receivers of the remote veras ? This is essential for testing purpose .
A picture will help surely.
Tnks
I want to write every metric like “Vera-45103914.012.urn^upnp-org^serviceId^VContainer1.Variable3” and the same value/timestamp to the wsp file "Vera-45103914.012.urn^upnp-org^serviceId^VContainer1.kwdaily3 associated to another schemas/aggregation rule.
So I’ve to modify the L_Datauser.lua module but I’m not sure.
The code I’ve to add is :
if string.match(metric, “Variable”) then
string.gsub(metric, “Variable”, “kwdaily”)
end
If I understand correctly, you want to change any incoming metric containing “Variable” in the variable name to “kwdaily”.
If so, then you need to replace the entire contents of the L_DataUser.lua “run” routine with this:
function run (metric, value, time)
local x,n = metric: gsub ("Variable", "kwdaily")
local i = 0
local metrics = {metric, n>0 and x or nil}
return function ()
i = i + 1
return metrics[i], value, time
end
end
If you mean to do something different, then the code will be different!
not quite, I want to write any metric containing “Variable” in the name, and another metric with the same value/time having in the name the word “Variable” substituted with “kwdaily”. Simply I wanto to duplicated the metric with a different name so I can apply a different schemas/aggregation.