EventWatcher: Is there a way to include a device?

@akbooer
trying to use the “ExtraVariablesFile” does this look right? Or am I way off…

348.urn:upnp-arduino-cc:serviceId:arduino1.Variable1

Yes, that looks right.
Is it not working?

nahh, so far not working… tried a couple more:

348.urn:upnp-arduino-cc:serviceId:arduino1.Variable1
348.urn:upnp-org:serviceId:AirQality1.VAR_1
348.urn:upnp-org:serviceId:VContainer1,Variable1

346.urn:upnp-arduino-cc:serviceId:TemperatureSensor1.CurrentTemperature

no luck…

Running latest version?
What is the file location in ExtraVariablesFile?
(Needs to start with / )

running the version from this post: http://forum.micasaverde.com/index.php/topic,16984.msg202835.html#msg202835

filelocation:
/www/EWextras.conf

OK, try this. Paste into Test Luup code and run it.

 local extrasFile = "/www/EWextras.conf"
 local f = io.open(extrasFile,'r')
    if f then
      for l in f: lines () do
        local dev, srv, var = l: match "^(%d+)%.([^%.]+)%.([^%.]+)"
        luup.log (table.concat {'EXTRA variable: ', var or '?','.', srv or '?','.', tonumber(dev or 0)})
      end
      f:close ()
    end

…then look in Vera’s log and see if you can find the lines listing the EXTRA variables.
This, bar one line, is exactly the code that EventWatcher uses to access the data.

local f = io.open(extrasFile,'r') if f then for l in f: lines () do local dev, srv, var = l: match "^(%d+)%.([^%.]+)%.([^%.]+)" luup.log (table.concat {'EXTRA variable: ', var or '?','.', srv or '?','.', tonumber(dev or 0)}) end f:close () end <0x2f844680> 50 12/06/14 20:24:13.593 luup_log:0: EXTRA variable: Variable1ctrl_chr.urn:upnp-arduino-cc:serviceId:arduino1.348 <0x2f844680> 50 12/06/14 20:24:13.593 luup_log:0: EXTRA variable: VAR_1ctrl_chr.urn:upnp-org:serviceId:AirQality1.348 <0x2f844680> 50 12/06/14 20:24:13.594 luup_log:0: EXTRA variable: CurrentTemperaturectrl_chr.urn:upnp-arduino-cc:serviceId:TemperatureSensor1.346 <0x2f844680> 50 12/06/14 20:24:13.595 luup_log:0: EXTRA variable: ?.?.0 <0x2f844680>

seems like it can access the file and read the content but the lines are probably still wrong. Maybe I should reach out to someone with more knowledge about the arduino plugin like @bulldoglowell.

The one line I changed… incorrectly orders the dev / srv / var names, so that’s why the log entry looks odd.

I could add a logging line to EventWatcher to actually record which variables it is successfully finding, if that’s any help.

In your earlier example you had a simple temperature variable. That should indeed work. Have you tried putting a ‘normal’ Vera device variable into the file and tried to watch that? Might point to the Arduino side of things.

NO, WAIT… Looking again at my log I see a control character concatenation with the variable name. If your file has CR LF instead of just LF, this may be the problem. Changing the Lua search string might fix the problem…

@korttoma

Try this. Hopefully should fix the problem?
Easiest way to check is to look at the Watched Variables report.
For extra variables, the room name is replaced by the name of the ExtraVariablesFile.

this is what the value looks like when Vera receives it from the node:

12/07/14 19:32:51.650 luup_log:276: Arduino: Set variable: 6;1;1;0;24;398 <0x2f223680>
12/07/14 19:32:51.650 luup_log:276: Arduino: Setting variable ‘Variable1’ to value ‘398’ <0x2f223680>
12/07/14 19:32:51.651 luup_log:276: Arduino: urn:upnp-org:serviceId:VContainer1,Variable1, 398, 348 <0x2f223680>
12/07/14 19:32:51.651 Device_Variable::m_szValue_set device: 348 service: urn:upnp-org:serviceId:VContainer1 variable: ctrl_chr[35;1mVariable1ctrl_chr[0m was: 407 now: 398 #hooks: 1 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f223680>
12/07/14 19:32:51.768 luup_log:276: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1417973571, 348 <0x2f223680>
12/07/14 19:32:51.769 Device_Variable::m_szValue_set device: 348 service: urn:micasaverde-com:serviceId:HaDevice1 variable: ctrl_chr[35;1mLastUpdatectrl_chr[0m was: 1417973470 now: 1417973571 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f223680>

trying with the following in the EWextras.conf now:
348.urn:upnp-org:serviceId:VContainer1,Variable1

Success!! Now it works ;D

That’s great! From your previous post I was concerned that the fix didn’t work.

Thanks for helping me to squash another bug.

I think the following problem: “50 12/06/14 20:24:13.595 luup_log:0: EXTRA variable: ?.?.0 <0x2f844680>” was caused by a typo on my part.

I had “348.urn:upnp-org:serviceId:VContainer1.Variable1” in the EWextras.conf instead of “348.urn:upnp-org:serviceId:VContainer1,Variable1”.

Glad you could squash a bug and thanks for all your fabulous plugins!

akbooer, is there anyway to have Event Watcher report back on the current wattage used on smart switches? I have my WatchCategories set to: XYSMTHK and it returns the watts for my Home Energy Meter but on my Aeon Labs Smart Switches it doesn’t show their watts as watched categories. Thank You

The EventWatcher semantics are based on device categories, in which each device of that type has specific services and variable, some of which are interesting to watch. The problem with [tt]Watts[/tt] is that any device may, or may not, have that variable, so it would have to be handled in an exceptional way.

The way you can do this, on a device-by-device basis, is to use the [tt]ExtraVariables[/tt] file to specify the exact devices for which you want to monitor power consumption.

And where do I find that file and what is an example of what I would put in it? Thank You!

Described in this thread.

I am working on an updated documentation set.

[Edit: removed re fence to moved thresd]

I’ve uploaded the file “L_EventWatcher.lua” listed in the below post, however, periodically the file seems to revert to the one included in the mios appstore. I’ve removed the auto update permission on the app, but this seems to happen about once a week. Any Idea how I can make the updated file indefinitely persistent?

[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]

I’ve never come across that problem before.

I've removed the auto update permission on the app, but this seems to happen about once a week.
Are you [u]sure[/u] that you've, in fact, removed the permission, because the App Store version does not set auto update?
Any Idea how I can make the updated file indefinitely persistent?
My only thought is that, indeed, you've actually [u]set[/u] it to update from the store, so it overrides the version you installed manually. Check mark should not be highlighted if this is set to "off".

You are running UI7?

Yes, I am sure that the app “auto update” is unchecked for the event watcher app.

I’m running UI5.

The updated file allows me to configure the additional watched devices perfectly once it’s re-uploaded after the file seems to revert. However, it only seems to last a week or two before it reverts. I just re-uploaded the file yesterday, so it may be a while before the issue comes up again.

When the issue happens I lose the custom variables in EWextras.conf until the L_EventWatcher.lua file is re-uploaded. I have not yet done a file compare or hash compare. I will do this the next time it happens to see if the files are indeed reverted.