myCallScene Event

A callScene event gets raised every time a scene is called in the system beacuse of an user interaction, a timed event and so on. It is possible to subscribe to this event, but using the json API it is not possible to get any useful event information from the internal callScene event at the moment. But it is possible to define an own event which will have all information of interest. I call the new event myCallScene. The following instructions are valid for our dSS11 server.

Course of action

The solution is to write a (java-)script which runs in the dSS. This script subscribes to the internal callScene event and raises a new event myCallScene when the callScene event is raised.

The script

var now = new Date();
var evt;

if (raisedEvent.source.isDevice) {
   evt = new Event("myCallScene",
          {
             dsid: raisedEvent.source.dsid,
             zoneID: raisedEvent.source.zoneID,
             sceneID: raisedEvent.parameter.sceneID,
             timestamp: now.getTime(),
             source: "isDevice" 
          }  );

} else
{
   evt = new Event("myCallScene",
          {
             zoneID: raisedEvent.source.zoneID,
             groupID: raisedEvent.source.groupID,
             sceneID: raisedEvent.parameter.sceneID,
             timestamp: now.getTime(),
             source: "isZone" 
          }  );
}
evt.raise();

Put this script to /usr/share/dss/data/scripts/callscene.js.
The script must be executed when the internal callScene event gets raised. So we need a subscription:

Subscription

<?xml version="1.0"?>
<subscriptions version="1">
  <subscription event-name="callScene" handler-name="javascript">
    <parameter>
      <parameter name="filename1">/usr/share/dss/data/scripts/callscene.js</parameter>
      <parameter name="script_id">callscene</parameter>
    </parameter>
  </subscription>
</subscriptions>

Put this subscription to /usr/share/dss/data/subscriptions.d/callscene.xml.

Now it is necessary to restart the dSS process. Use the web interface or just type: sv restart dss

Finish.

See here how to use the myCallScene event using the json-API: MyCallSceneEventAddOn.