Author Topic: Documentation for eventlist2 in json file (beyond UI4 UI5 migration wiki page)  (Read 235 times)

Offline floyderman3d

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
Hi,

I was wondering if there was an online resource with full (or at least decent) explanation of the possible options in eventlist2 key in json file.

I have gone through UI4 / UI5 Migration wiki document, but it just explains some changes from UI4 to UI5, not being a comprehensive description of this feature. I have not found other useful documents in the wiki, so it's a bit confusing for me.

As an example, I don't know which are the possible values for datatype. By having a look to several json files I have seen datatypes boolean, i4, ui2... I don't really know the meaning of the last two ones. I guess they are numbers, but I'm not sure of their implications.

Thanks and best regards.

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 818
  • Karma: +54/-8
As I understand it these are UPnP data types eg:

https://jan.newmarch.name/java/jini/upnpLUS/specification.html

http://www.upnp.org/specs/av/UPnP-av-AVDataStructureTemplate-v1-20101231.pdf

The Vera implementation seems at little broken in this regard - data types are typically not required and/or ignored.

If writing a plugin, I would avoid the use of eventlist2 and encourage your plugin users to place a watch on interesting variables using the AltUI plugin for events. Likewise openLuup doesn't take any notice of eventlist2.

Hope I have this all correct - it's a hazy area :-\  If not, I'm sure @akbooer will let us know.
« Last Edit: April 11, 2018, 02:15:30 am by a-lurker »

Offline akbooer

  • Master Member
  • *******
  • Posts: 5753
  • Karma: +246/-69
  • "Less is more"
The Vera implementation seems at little broken in this regard - data types are typically not required and/or ignored.

You are not wrong!  Vera has taken tremendous liberties with this and almost every other aspect of UPnP.  Take, for example, the handling of temperature, which should have units of hundredths of a degree Celsius (see TemperatureSensor:1 Service Template) but in Vera is forced to be integer increments of Fahrenheit or Centigrade or who knows what, depending...

Quote
If writing a plugin, I would avoid the use of eventlist2 and encourage your plugin users to place a watch on interesting variable using the AltUI plugin for events. Likewise openLuup doesn't take any notice of eventlist2.

Lifting a comment from the openLuup loader module...

Code: [Select]
-- openLuup doesn't use the json files, except to put into the static_data structure
-- which is passed on to any UI through the /data_request?id=user_data HTTP request.
... and that is how AltUI uses it.

openLuup itself completely eschews the EventsList2 mechanism in favour of AltUI's variable watch triggers.  How weird to have a device implementer try and guess in advance how you might want to define an event?  Variable watches are much more flexible.

Quote
Hope I have this all correct - it's a hazy area :-\  If not I'm sure @akbooer will let us know.

Hazy is too polite, but I'll let it rest!
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 2x Philips Hue
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay, ZeroBrane Studio.

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1269
  • Karma: +71/-30
Hi,

One thing I found on UI7 is that the variables you want to have events on must be specified in the S_....xml file serviceStateTable with the sendEvents=yes attribute. If you do not and the event condition is true when the Vera starts is can trigger a restart and thus an endless loop of restarts. I have not tested is this is still true with the latest release, but as specifying your variables should be done according to the UPnP standard anyway I think it is a good idea to do so.

The datatype and default attributes seem to be completely ignored, but you can also see that as a sort of documentation on your plugins variables. It has helped me to remember why I did what I did later on in several occasions.

Have fun creating one.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 338
  • Karma: +46/-0
    • toggledbits.com
Combining what akbooer and reneboer have said, I always found eventlist2 both troublesome and redundant. As reneboer said, the service (S_.xml) file is already a place where service variable declarations for important values are made, including the useful (and unused by Vera) type and default. It is also where actions for the service are declared. This is sufficient to allow any other service, Lua, or UI to determine what watches, events, and actions are possible for the service; all the information is already there. We just need an easy way to get to that service data, and eventlist2 could just go away.
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline floyderman3d

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
Hi,

Thanks a lot for all your replies. Once again, they are very lightening.

Cheers!