Luup Events

From MiOS
Jump to: navigation, search

Events are tied to one or more UPnP Variables and cause the scene they're attached to to run when the variables are set to a given value.

In user_data, the definition of the event is defined, which is actually just copied from the eventList in the device description XML doc. The following defines the "Thermostat Mode Changes" event for thermostats. It takes 1 argument which is a pull-down since allowedValueList is defined, and which is tied to the variable named "ModeStatus". You can have multiple arguments but they're all in the same service. It is compared with an equal (=) as opposed to: < > ~ (~ is not equal).

         "eventList": {
               "event_1": {
                   "serviceStateTable": {
                       "ModeStatus": "dummyvalue" 
                   },
                   "argumentList": {
                       "argument_1": {
                           "allowedValueList": {
                               "Off": "Off",
                               "Cool": "CoolOn",
                               "Heat": "HeatOn",
                               "Auto": "AutoChangeOver" 
                           },
                           "dataType": "string",
                           "defaultValue": "",
                           "name": "ModeStatus",
                           "comparisson": "=",
                           "prefix": "Which mode",
                           "suffix": "none" 
                       } 
                   },
                   "label": "Thermostat Mode Changes",
                   "serviceId": "urn:upnp-org:serviceId:HVAC_UserOperatingMode1" 
               },

The users parameters are stored in the scene:

           "Device_Num_3": {
               "event_1_1": {
                   "name": "cool2",
                   "Enabled": "1",
                   "argument_1": "CoolOn" 
               } 
           } 
       } 

So it's device number 3, event_1 refers to the event_1 template for the device and the subsequent _1. The value for argument_1 is "CoolOn".

Personal tools