[quote=“akbooer, post:1, topic:185677”]Here’s an update to EventWatcher which, in addition to the usual category-based method of defining which devices to watch, now allows ANY serviceId/variable to be watched.
I’ve simply added another device variable parameter [tt]ExtraVariablesFile[/tt] which defines the location of a file with the description of one variable per line in the format ... This file is read at startup and the requested variables added to the watch list.
So, for example, my [tt]ExtraVariablesFile[/tt] is set to [tt]/www/EWextras.conf[/tt], and that file contains:
044.urn:akbooer-com:serviceId:EventWatcher1.AppMemoryUsed
044.urn:akbooer-com:serviceId:EventWatcher1.CpuLoad05
For @clippermiami, the required line to watch an Arduino barometric pressure on device 123 would be:
123.urn:upnp-org:serviceId:BarometerSensor1.CurrentPressure
This should avoid anyone asking for bespoke changes to EventWatcher… should have done it long ago![/quote]
Hello,
I’ve followed the preceding protocol letter by letter, but something weird’s happening. Only the last variable, corresponding to the last line in my ExtraVariablesFile, is read.
When requesting the watched data (data_request?id=lr_EventWatcher&report=watch), it confirms my observation:
there is never more than one row with the ‘room’ column specifying ‘/www/Eventext.conf’ (my extra file)
If I switch lines in the file, it still the last variable that is been taken into account. My ExtraVariablesFile file:
18.urn:upnp-micasaverde-com:serviceId:Weather1.WindSpeed
26.urn:rts-services-com:serviceId:DayTime.Status
29.urn:micasaverde-com:serviceId:EnergyMetering1.Watts
37.urn:upnp-org:serviceId:TemperatureSensor1.CurrentTemperature
29.urn:micasaverde-com:serviceId:EnergyMetering1.KWH
2 ideas came to my mind:
- something is missing or added at the end of each line, so that the function in the L_Eventwatcher.lua file doesn’t read them (I’m using Textpad, a text editor, to write my progs).
- one of the variable returns an error (but I’ve tried all of them in the final line, everything seems ok) … same effect as described in last sentence
I’ve also checked the code in the lua file, can’t see any issue??
if extrasFile ~= '' then
local f = io.open(extrasFile,'r')
if f then
for l in f: lines () do
local dev, srv, var = l: match "^(%d+)%.([^%.]+)%.([^%.]+)"
watch (var, srv, tonumber(dev), l, extrasFile)
end
f:close ()
end
end
Thanks a lot for your impressive work, it helped me a lot.