Service Definition Information - where can I find more

Hey there. For a service state table definitions, what do the following do?

In general, is there a good tutorial or information on service definitions?

Also. If I have a state variable called say “DoorStatus”, should I create an Action function called “SetDoorStatus” or should the caller simply call “luup.variable_set”? As well, with these two methods (Action function vs variable_set), what do the “stateVariable” items discussed above have to do with either?

Sorry for basic questions. Still plowing through.

Hey there. For a service state table definitions, what do the following do?

sendEvents is a UPnP flag. It has no purpose (AFAIK) in a Vera plugin. allowRepeats determines whether an event is raised whenever the variable is updated or only when the value changes. “no” means that the event fire only for changes. “yes” means that it fires for each update.

In general, is there a good tutorial or information on service definitions?

I haven’t seen one.

Also. If I have a state variable called say "DoorStatus", should I create an Action function called "SetDoorStatus" or should the caller simply call "luup.variable_set"? As well, with these two methods (Action function vs variable_set), what do the "stateVariable" items discussed above have to do with either?

Plugins usually implement Setxxxx actions when something other than a simple change to a variable is required. Actions are also necessary to allow scenes and other plugins (like PLEG) to initiate some change to the plugin device. If possible, use standard serviceIDs and actions when you can. This will make it easier for remote Apps to support your plugin.

It is quite possible to write a plugin without specifying any stateVariables in the S_xxxx.xml file. You can create whatever device variables you need in your implementation code. Actions are a different matter. They do need to be specified in the S_xxxx.xml file so that Vera scenes, PLEG and other plugins know what is supported.

The D_xxxx.json file also plays into this. This sets the available actions for scenes and PLEG when using the Devices tab for point-and-click selection. This is also where events that may be used for triggers are specified (and are affected be the allowRepeats option).

thanks again Rex!