EventWatcher: Is there a way to include a device?

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=“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]

Excellent solution :slight_smile:

[quote=“clippermiami, post:2, topic:185677”][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]

Excellent solution :-)[/quote]

Is the Device ID the PARENT or the Individual Sensor. for example in my case the

PARENT “MySensors Plugin” is DevID 06
NODE for the Sensor is DevID 60
PRESSURE SENSOR is DevID 59

Individual sensor, as I understand it.

Thanks I’ll try that.

@akbooer, that did it for my request thanks

Great - another happy customer.

:smiley: @ClipperMiami - thanks for asking the question - I was just searching for the answer to this question and found this thread.

@akbooer and hek - thanks for the excellent coding and working together to make it all mesh. Building my own sensors and having them work together with my Vera is really bringing my home automation together! Your code makes helps that possible.

As a child, I was promised flying cars in “this future” (the Jetsons) and while I don’t have that yet, we are getting a little closer.

The config file update is working great for me.

Thanks!

Thank you @sleepyhat… I think I’m now inspired to have a go at making my own sensors. (Always wanted an induction loop doorway sensor, can’t for the life of me think why these aren’t available, but I suppose I will find out !)

So why not start with a flying car :slight_smile:

I can’t make the extra variables function work. The variables I add don’t show up under Watched Variables nor the Variable and Event Log.

I had the app store version of Event Watcher, and then I updated the L_EventWatcher.lua file to the version here: [url=http://forum.micasaverde.com/index.php/topic,16984.msg184815.html#msg184815]http://forum.micasaverde.com/index.php/topic,16984.msg184815.html#msg184815[/url]

Then I created file EWextras.conf in www with the line “063.urn:akbooer-com:serviceID:EventWatcher1.MemFree”

And finally I set my ExtrasVariableFile to /www/EWextras.conf

Your library file might be out of synch. Try also loading the attachment Lua file on this post
[url=http://forum.micasaverde.com/index.php/topic,16984.msg182104.html#msg182104]http://forum.micasaverde.com/index.php/topic,16984.msg182104.html#msg182104[/url]

Otherwise I’ll post a complete new install (I really must update the App Store version.)

How do I resync the library file? I updated L_EventWatcher2.lua, restarted and rebooted, and still don’t see the extra variables, but I do see that I am tracking more states on my thermostats!

You’ve done what you need to update the system. I see now that your problem is a spelling mistake in the configuration file ( if what you wrote is, indeed, what you have), it should be “serviceId”, not “serviceID”.

You are far from the first Vera user who has made this mistake!

Yes, changing to serviceId fixed the issue on that variable - thanks!

I will haven’t quite figure out how to track a z-wave LastWakeUp, like you suggested here. [url=http://forum.micasaverde.com/index.php/topic,26414.msg187329.html#msg187329]http://forum.micasaverde.com/index.php/topic,26414.msg187329.html#msg187329[/url]

I have 70.urn:micasaverde-com:serviceId:ZWaveDevice1.LastWakeup in the file now and I know that is the right device ID. Do I need to alter this for the specific device type? Meaning if I look at device_type for the device in the GUI, I see “urn:schemas-micasaverde-com:device:MotionSensor:1”

So would the entry for the file referenced in ExtraVariablesFile need to be something like 70.urn:micasaverde-com:serviceId:MotionSensor1.LastWakeup?

Good, glad that worked.

The ExtraVariablesFile syntax is independent the device type - all the information it need is supplied by the device number, the serviceId, and the variable name.

“70.urn:micasaverde-com:serviceId:MotionSensor1.LastWakeup” should do the trick.

akbooer
how do I log Ping Sensor devices? urn:schemas-demo-ted-striker:device:PingSensor:1

I’m having trouble isolating a problem and need to see when these devices are changing.

thanks!

Hi,

Where would the EWextras.conf file reside if this is uploaded using the standard Upload Luup files from the Develop Apps ? Would it go into the www/ directory or somewhere else ?

I really need to get this working but can’t see any errors or confirmation if my file and variables are being read. I am using v 2014.07.18 @akbooer

Thanks

David

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

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

I currently have a two-line extras file working OK. Does your text editor do anything special with end of lines? eg. , rather than just ?