— EventWatcher is now available from the App Store — [url=http://apps.mios.com/plugin.php?id=4726]MiOS Apps
Here’s a plugin called EventWatcher, which does three things: [Edit: actually, rather more now - see the documentation PDF for details]
[ol][li]functions as a local ‘Alternate Event Server’ for Vera notifications[/li]
[li]watches selected device categories and logs key variable changes[/li]
[li] generates snapshots of current device variable values and time last changed [/li][/ol]
…all the above written to plain text files, very simple formats, viewable with a web browser.
The whole point is to address the needs voiced by those who want:
[ol][li]access to events locally and independently of Mios.com[/li]
[li]much simpler and less cluttered logging[/li]
[li]simple reporting of device status[/li][/ol]
This, in no way, is meant to replace LogViewer or InfoViewer. It’s just a simple tool that may be useful.
Events:
The functionality of an Alternate Event Server is described here [url=http://wiki.micasaverde.com/index.php/AlternateEventServer]http://wiki.micasaverde.com/index.php/AlternateEventServer[/url] and elsewhere, but all that’s need is to browse this URL
http://[your Vera IP]:3480/data_request?id=variableset&Variable=AltEventServer&Value=127.0.0.1
and you should receive the status OK.
[s]EventWatcher then writes each event to a file specified by the variable [tt]eventFilename[/tt] (by default “/www/events.txt”) which is over-written on every restart (to keep the size down). If this variable is blank, then EventWatcher doesn’t run this functionality.
In addition, a JSON string with the event parameters is written to the variable [tt]jsonString[/tt] which can be watched by another application and read to process the event further. (This string doesn’t display correctly in UI5 because it contains quote characters, but it’s really all there.)[/s]
Watched Variables:
To make it simple to specify which variables to watch, EventWatcher uses the Luup device categorisation listed here: ([url=http://wiki.micasaverde.com/index.php/Luup_UPNP_Files#Device_Categories]http://wiki.micasaverde.com/index.php/Luup_UPNP_Files#Device_Categories[/url]).
The numeric values have been mapped to a single character symbol, and a variable [tt]WatchCategories[/tt] containing a string of these letters specifies which categories to watch. Within each category, there is the choice to watch either ALL the variables of the matching service, or just the most significant one (eg. CurrentTemperature, or CurrentLevel), as defined by [tt]WatchAllVsInService[/tt] (enabled by the value “1”). The category number, symbol, service and variable names are defined in the table below:
1. "F", -- DEVICE_CATEGORY_INTERFACE
2. "X", "urn:upnp-org:serviceId:SwitchPower1", "Status" -- DEVICE_CATEGORY_DIMMABLE_LIGHT
3. "X", "urn:upnp-org:serviceId:SwitchPower1", "Status" -- DEVICE_CATEGORY_SWITCH
4. "S", "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped" -- DEVICE_CATEGORY_SECURITY_SENSOR
5. "K", -- DEVICE_CATEGORY_HVAC
6. "C", -- DEVICE_CATEGORY_CAMERA
7. "D", -- DEVICE_CATEGORY_DOOR_LOCK
8. "W", -- DEVICE_CATEGORY_WINDOW_COV
9. "R", -- DEVICE_CATEGORY_REMOTE_CONTROL
10. "I", -- DEVICE_CATEGORY_IR_TX
11. "O", -- DEVICE_CATEGORY_GENERIC_IO
12. "G", "urn:micasaverde-com:serviceId:GenericSensor1", "CurrentLevel" -- DEVICE_CATEGORY_GENERIC_SENSOR
13. "B", -- DEVICE_CATEGORY_SERIAL_PORT
14. "Y", "urn:micasaverde-com:serviceId:SceneController1", "sl_SceneActivated" -- DEVICE_CATEGORY_SCENE_CONTROLLER
15. "V", -- DEVICE_CATEGORY_AV
16. "H", "urn:micasaverde-com:serviceId:HumiditySensor1", "CurrentLevel" -- DEVICE_CATEGORY_HUMIDITY
17. "T", "urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature" -- DEVICE_CATEGORY_TEMPERATURE
18. "L", "urn:micasaverde-com:serviceId:LightSensor1", "CurrentLevel" -- DEVICE_CATEGORY_LIGHT_SENSOR
19. "Z", -- DEVICE_CATEGORY_ZWAVE_INT
20. "J", -- DEVICE_CATEGORY_INSTEON_INT
21. "M", "urn:micasaverde-com:serviceId:EnergyMetering1", "Watts" -- DEVICE_CATEGORY_POWER_METER
22. "A", -- DEVICE_CATEGORY_ALARM_PANEL
23. "P", -- DEVICE_CATEGORY_ALARM_PARTITION
You’ll see that some services/variables are missing - I’m open to suggestions as to how to populate these items.
Every time a watched variable changes, a line is written to a file specified by the variable [tt]WatchFilename[/tt] (by default “/www/watch.txt”), which is similarly over-written on every restart. To keep the file length down, PING sensors are excluded from the watched security devices.
The default [tt]WatchCategories[/tt] string is “XYSM”, which watches switches and dimmers, scene controllers, security devices, and meters.
[s]Status Reports:
Currently, status reports may be generated for two major groups of sensors: environmental measurements (Temperature, Humidity, Light, Generic), and security devices (category 4). Whether these reports are generated depends on the value of two variables ([tt]SensorFilename[/tt] and [tt]SecurityFilename[/tt]) with appropriate defaults (“/www/sensors.txt” and “/www/security.txt”). These reports are generated on regular intervals as specified by the variable [tt]SensorBlogInterval[/tt] (in units of minutes).
Installation:
The key and certificate files should go into a top-level directory (you will have to create) /eventServer/. The icon file goes to /www/cmh/skins/default/icons/. Other files can be uploaded via UI5 using Luup files > Browse > Upload. [/s]
[—Edit" Most of the above text is hopelessly out of date now, but I keep it for posterity. Read the documentation PDF for THE TRUTH —]
Comments/ideas welcomed.
— EventWatcher is now available from the App Store — [url=http://apps.mios.com/plugin.php?id=4726]MiOS Apps