Difference between revisions of "Websockets Documentation"

From SecuriWiki
Jump to: navigation, search
(Created page with "== Authentication == In order to connect to the webserver - first specify a web-interface url, then the portid - 7681 followed by web-interface login password.<br /> <webinte...")
 
 
(87 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category:Almond+ 2014]]
 +
[[Category:Almond 2015]]
 +
[[Category:Almond 3]]
 +
Websocket is the protocol for establishing an interaction channel between an external application and Almond. It is also possible to receive event-based notifications. Websocket can be used to control [https://wiki.securifi.com/index.php/Devicelist_Documentation '''smart devices'''] that are paired with Almond and build smart applications around it.
 +
 
== Authentication ==
 
== Authentication ==
 
In order to connect to the webserver - first specify a web-interface url, then the portid - 7681 followed by web-interface login password.<br />
 
In order to connect to the webserver - first specify a web-interface url, then the portid - 7681 followed by web-interface login password.<br />
Line 14: Line 19:
 
Command to get the list of sensors and other smart devices associated with the almond. <br />
 
Command to get the list of sensors and other smart devices associated with the almond. <br />
  
Request
+
Request
 
  {   
 
  {   
   "mii":"<random key>",
+
   "MobileInternalIndex":"<random key>",
   "cmd":"devicelist"
+
   "CommandType":"DeviceList"
 
  }
 
  }
  
Response
+
Response
  {  
+
  {
  "mii":"<random key>","commandtype":"devicelist","data" : {"1":{"devicename":"ContactSwitch #1","friendlydevicetype":"ContactSwitch","devicetype":"12","deviceid":"1","location":"Default","devicevalues":
+
  "MobileInternalIndex":"<random key>",
  {"1":   {"index":"1","name":"STATE","value":"true"},"2":{"index":"2","name":"LOW BATTERY","value":"0"},"3":{"index":"3","name":"TAMPER","value":"true"}}},"2":{"devicename":"BinarySwitch
+
  "CommandType":"DeviceList",
  #2","friendlydevicetype":"BinarySwitch","devicetype":"1","deviceid":"2","location":"Default","devicevalues":{"1":{"index":"1","name":"SWITCH BINARY","value":"true"}}}}
+
  "Devices":{
 +
      "1":{
 +
        "Data":{
 +
                "ID":"1",
 +
                "Name":"ContactSwitch #1",
 +
                "Type":"12",
 +
                "FriendlyDeviceType":"ContactSwitch",
 +
                "Location":"Default",
 +
                "LastActiveEpoch":"1462172879",
 +
                "Manufacturer":"Sercomm Corp.",
 +
                "Version":"16",
 +
                "Model":"Unknown",
 +
                "DeviceState":"1"
 +
        },
 +
        "DeviceValues":{ 
 +
            "1":{ 
 +
              "Name":"STATE",
 +
              "Value":"true",
 +
              "Type":"4"
 +
            },
 +
            "2":{
 +
              "Name":"LOW BATTERY",
 +
              "Value":"0",
 +
              "Type":"12"
 +
            },
 +
            "3":{
 +
              "Name":"TAMPER",
 +
              "Value":"true",
 +
              "Type":"9"
 +
            }
 +
        }
 +
      },
 +
      "2":{  
 +
        "Data":
 +
                "ID":"2",
 +
                "Name":"BinarySwitch #2",
 +
                "Type":"1",
 +
                "FriendlyDeviceType":"BinarySwitch",
 +
                "Location":"Default",
 +
                "LastActiveEpoch":"1462175634",
 +
                "Manufacturer":"Sercomm Corp.",
 +
                "Version":"16",
 +
                "Model":"SZ-BSW01",
 +
                "DeviceState":"1"
 +
        },
 +
        "DeviceValues":{ 
 +
            "1":{ 
 +
              "Name":"SWITCH BINARY",
 +
              "Value":"true",
 +
              "Type":"1"
 +
            }
 +
        }
 +
      }
 +
  }
 
  }
 
  }
  
=== Setdeviceindex ===
+
=== Updatedeviceindex ===
Command to set the device index value without timeout.  <br />
+
  
Request
+
Request
+
  "mii":"<random key>",
+
  "cmd":"setdeviceindex",
+
  "devid":"<device id>",
+
  "index":"<deviceindex>",
+
  "value":"<indexvalue>"
+
}
+
 
+
Response<br />
+
Success<br />
+
{
+
  "mii":"<random key>","commandtype":"setdeviceindex","success":"true","data":{"devid":"<deviceid>","index":"<deviceindex>","value":"<indexvalue>"}
+
}<br />
+
Failure<br />
+
 
  {
 
  {
  "mii":"<random key>","commandtype":"setdeviceindex",:"success":"false"}
+
"MobileInternalIndex":"<random key>",
 +
"CommandType":"UpdateDeviceIndex",
 +
"ID":"<device id>",
 +
"Index":"<deviceindex>",
 +
"Value":"<indexvalue>"
 
  }
 
  }
<br />
+
Response<br />
Example<br />
+
  {
In the following example, the value of index 1 is set to ‘true’ for device id 2.<br />
+
  "MobileInternalIndex":"<random key>",
  {
+
  "CommandType":"UpdateDeviceIndex",
  "mii":"jdnbc",
+
  "Success":"true/false"
  "cmd":"setdeviceindex",
+
  "devid":"2",
+
  "index":"1",
+
  "value":"true",
+
  "timeout":"2000"
+
 
  }
 
  }
Response <br />
 
{
 
  "mii":"jdnbc","commandtype":"setdeviceindex","success":"true","data":{"devid":"2","index":"1","value":"true"}
 
}<br />
 
 
 
===Getdeviceindex===
 
===Getdeviceindex===
Command to get the value of a device index.
+
Command to get the value of a device index.
Request
+
 +
Request
 
  {   
 
  {   
  "mii":"<random key>",
+
"MobileInternalIndex":"<random key>",
   "cmd":"getdeviceindex",
+
   "CommandType":"GetDeviceIndex",
   "devid":"<deviceid>",
+
   "ID":"<deviceid>",
   "index":"<deviceindex>"
+
   "Index":"<deviceindex>"
 
  }
 
  }
Response<br />
+
Response<br />
Success
+
  {
  {
+
  "MobileInternalIndex":"<random key>",
  "mii":"<random key>","commandtype":"getdeviceindex","success":"true","data":{"devid":"<deviceid>","index":"<deviceindex>","value":"<indexvalue>"}
+
  "CommandType":"GetDeviceIndex",
}
+
  "Success":"true/false",
Failure
+
  "Value":"<indexvalue>"
{
+
  "mii":"<random key>","commandtype":"getdeviceindex","success":"false"
+
}
+
Example
+
In the following example, value of index 1 is retrieved for device id 2.
+
{
+
  "mii":"jdnbc",
+
  "cmd":"getdeviceindex",
+
  "devid":"2",
+
  "index":"1"
+
}
+
Response
+
{
+
  "mii":"jdnbc","commandtype":"getdeviceindex","success":"true","data":{"devid":"2","index":"1","value":"false"}
+
 
  }
 
  }
  
===Editdevicename===
+
===UpdateDeviceName===
 
Command to edit name and location of a device.<br />
 
Command to edit name and location of a device.<br />
 
Request<br />
 
Request<br />
 
  {  
 
  {  
   "mii":"<random key>",
+
   "MobileInternalIndex":"<random key>",
   "cmd":"editdevicename",
+
   "CommandType":"UpdateDeviceName",
   "devid":"6",
+
   "ID":"6",
   "name":"newswitchsss",
+
   "Name":"newswitchsss",
   "location":"default"
+
   "Location":"default"
 
  }
 
  }
Response<br />
+
Response<br />
Success
+
+
  "mii":"<random key>","commandtype":"editdevicename","success":"true"
+
}
+
Failure
+
 
  {   
 
  {   
  "mii":"<random key>","commandtype":"editdevicename","success":"false"
+
  "MobileInternalIndex":"<random key>",
 +
  "CommandType":"UpdateDeviceName",
 +
  "Success":"true/false"
 
  }
 
  }
  
 
===Updatealmondmode===
 
===Updatealmondmode===
Command to change the almond mode.<br />
+
Command to change the almond mode.<br />
Request<br />
+
Request<br />
 
  {
 
  {
   "mii":"<random key>",
+
   "MobileInternalIndex":"<random key>",
   "cmd":"updatealmondmode",
+
   "CommandType":"UpdateAlmondMode",
   "mode":"<mode i.e.  2/3>",
+
   "Mode":"<mode i.e.  2/3>",
   "emailid":"<email id>"
+
   "EmailId":"<email id>"
 
  }
 
  }
Response<br />
+
Response<br />
Success
+
  {
  {
+
  "MobileInternalIndex":"<random key>",
  "mii":"<random key>","commandtype":"updatealmondmode","success":"true","data":{"mode":"2","emailid":"swetha.reddy@securifi.com"}
+
  "CommandType":"UpdateAlmondMode",
 +
  "Success":"true/false"
 
  }
 
  }
 
<br />
 
<br />
Failure
+
 
{
+
  "mii":"<random key>","commandtype":"updatealmondmode","success":"false"
+
}
+
<br />
+
 
==Rules Commands==
 
==Rules Commands==
 
Note: mii is a random key that is generated by the client and should be used for matching the received response to the corresponding request. Maximum string length of mii is 32 characters. A unique mii should be used for each request.<br />
 
Note: mii is a random key that is generated by the client and should be used for matching the received response to the corresponding request. Maximum string length of mii is 32 characters. A unique mii should be used for each request.<br />
 
===Ruleslist===
 
===Ruleslist===
Command to get the list of existing rules.
+
Command to get the list of existing rules.<br /><br />
 
Request:<br />
 
Request:<br />
  {
+
  {
  "mii":"<random key>",
+
  "CommandType":"RuleList",
   "cmd":"ruleslist"
+
   "MobileInternalIndex":"111"
 
  }
 
  }
 
<br />
 
<br />
 +
 
Response:<br />
 
Response:<br />
{ "mii":"<random key>","commandtype":"ruleslist" ,"data" :{"2":{"ruleid":"2","name":"r1","valid":"1","triggers":{"1":
+
 
  {"triggerid":"1","triggertype":"EventTrigger","eventtype":"AlmondModeUpdated","eventid":"1","groupingtype":"AND","condition":"eq","validation":"true","value":"home"}},"results":{"1":
+
  {"resultid":"1","resulttype":"DeviceResult","deviceid":"6","deviceindex":"1","predelay":"2","validation":"true","value":"false"}}},"3":{"ruleid":"3","name":"r2","valid":"1","triggers":{"1":
+
  {"triggerid":"1","triggertype":"TimeTrigger","range":"0","hour":"5","minutes":"3","dayofmonth":"*","dayofweek":"1,2,3,4,5","monthofyear":"*","groupingyear":"AND","validaion":"true"},"2":
+
  {"triggerid":"2","triggertype":"EventTrigger","eventtype":"AlmondModeUpdated","eventid":"1","groupingtype":"AND","condition":"eq","validation":"true","value":"home"},"3":
+
  {"triggerid":"3","triggertype":"DeviceTrigger","deviceid":"6","deviceindex":"1","groupingtype":"AND","condition":"eq","validation":"true","value":"false"}},"results":{"1":
+
  {"resultid":"1","resulttype":"DeviceResult","deviceid":"20","deviceindex":"3","predelay":"0","validation":"true","value":"0"}}}}
+
}<br />
+
===Createrule===
+
Command to create a new rule.<br />
+
Request<br />
+
+
  "mii":"<random key>",
+
  "cmd":"createrule",
+
  "rulename":"<name of rule>"
+
}<br />
+
Response<br />
+
Success<br />
+
{
+
  "mii":"<random key>","commandtype":"createrule","success":"true","data":{"ruleid":"<ruleid>","rulename":"<name of rule>"}
+
}
+
<br />
+
Failure<br />
+
 
  {
 
  {
  "mii":"<random key>","commandtype":"createrule","success":"false"
+
        "CommandType": "RuleList",
 +
        "Rules": {
 +
                "12": {
 +
                        "Name": "mynewrule",
 +
                        "Valid": "true",
 +
                        "ID":"12",
 +
                        "Triggers": [{
 +
                                "Type": "<type of trigger>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "Grouping": "< AND/OR>",
 +
                                "Condition": "<condition type ie.eq/le/ge/lt/gt>",
 +
                                "Duration": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }],
 +
                        "Results": [{
 +
                                "Type": "<type of result>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "PreDelay": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }, {
 +
                                "Type": "<type of result>",
 +
                                "ID": "<event id>",
 +
                                "EventType": "<event type>",
 +
                                "Value": "<event value>",
 +
                                "PreDelay": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }]
 +
                },
 +
                "13": {
 +
                        "Name": "mynewrule",
 +
                        "Valid": "true",
 +
                        "ID":"13"
 +
                        "Triggers": [{
 +
                                "Type": "<type of trigger>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "Grouping": "< AND/OR>",
 +
                                "Condition": "<condition type ie.eq/le/ge/lt/gt>",
 +
                                "Duration": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }],
 +
                        "Results": [{
 +
                                "Type": "<type of result>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "PreDelay": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }, {
 +
                                "Type": "<type of result>",
 +
                                "ID": "<event id>",
 +
                                "EventType": "<event type>",
 +
                                "Value": "<event value>",
 +
                                "PreDelay": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }]
 +
                }
 +
        }
 
  }
 
  }
 
<br />
 
<br />
Example<br />
+
 
In the following example, a new rule with rule name ‘myrule’ is created.<br />
+
===Addrule===
+
Command to create a new rule.<br />
  "mii":"kjvfjk",
+
  "cmd":"createrule",
+
  "rulename":"myrule"
+
}
+
Response
+
{
+
  "mii":"kjvfjk","commandtype":"createrule","success":"true","data":{"ruleid":"4","rulename":"myrule"}
+
}
+
<br />
+
===Removerule===
+
Command to remove an existing rule.<br />
+
 
Request<br />
 
Request<br />
{
 
  "mii":"<random key>",
 
  "cmd":"removerule",
 
  "ruleid":"1"
 
}
 
<br />
 
Response
 
Success
 
 
  {
 
  {
  "mii":"<random key>","commandtype":"removerule.","success":"true","data":{"ruleid":"<ruleid>","rulename":"<name of rule>"}
+
    "MobileInternalIndex": "111",
}
+
    "CommandType": "AddRule",
<br />
+
    "Name": "rule",     
Failure<br />
+
    "Valid":"true",
1 - {   "mii":"<random key>","commandtype":"removerule.","success":"false","data":{"ruleid":"<ruleid>"}}
+
    "Triggers": [
2 - {   "mii":"<random key>","commandtype":"removerule.","success":"false"}
+
        {
<br />
+
            "Type": "<type of trigger>",
Example<br />
+
            "ID": "<device id>",
In the following example, the rule with ruleid=1 is removed.<br />
+
            "Index": "<device index>",
 +
            "Value": "<index value>",
 +
            "Grouping": "< AND/OR>",
 +
            "Condition": "<condition type ie.eq/le/ge/lt/gt>",
 +
            "Duration": "<time in sec>",
 +
            "Valid": "true"
 +
        },
 +
        {
 +
            "Type": "<type of trigger>",
 +
            "ID": "<event id>",
 +
            "EventType": "<event type>",
 +
            "value": "<event value>",
 +
            "Grouping": "<AND/OR>",
 +
            "Condition": "<condition type ie.eq/le/ge/lt/gt>",
 +
            "Duration": "<time in sec>",
 +
            "Valid": "true"
 +
        }
 +
    ],
 +
    "Results": [
 +
        {
 +
            "Type": "<type of result>",
 +
            "ID": "<device id>",
 +
            "Index": "<device index>",
 +
            "Value": "<index value>",
 +
            "PreDelay": "<time in sec>",
 +
            "Valid": "true"
 +
        },
 +
        {
 +
            "Type": "<type of result>",
 +
            "ID": "<event id>",
 +
            "EventType": "<event type>",
 +
            "Value": "<event value>",
 +
            "PreDelay": "<time in sec>",
 +
            "Valid": "true"
 +
  }
 +
  ]
 +
}<br /><br />
 +
 
 +
Response<br />
 
  {   
 
  {   
  "mii":"dhbdc",
+
    "CommandType":"AddRule",
  "cmd":"removerule",
+
    "Success":"true",
  "ruleid":"1"
+
    "MobileInternalIndex":"111",
 +
    "ReasonCode":"1"
 
  }
 
  }
 
<br />
 
<br />
Response<br />
+
 
{
+
===Updaterule===
  "mii":"dhbdc","commandtype":"removerule.","success":"true","data":{"ruleid":"1","rulename":"myrule"}
+
Command to update an existing rule.<br />
}
+
===Addtrigger===
+
Rule are actuated by triggers. Whenever the trigger conditions are all true the related rule is triggered. Commands described in the following section can be used to to add different types of triggers to rules.
+
<br />
+
====DeviceTrigger====
+
Command to add a device trigger in a rule.<br />
+
 
Request<br />
 
Request<br />
{
 
  "mii":"<random key>",
 
  "cmd":"addtrigger",
 
  "ruleid":"<ruleid>",
 
  "triggertype":"<type of trigger>",
 
  "deviceid":"<device id>",
 
  "deviceindex":"<device index>",
 
  "indexvalue":"<index value>",
 
  "grouping":"<grouping i.e. AND/OR>",
 
  "condition":"<condition type ie.eq/le/ge/lt/gt>",
 
  "duration":"<time in sec>"
 
}
 
Response<br />
 
Success<br />
 
{
 
  "mii":"<random key>", "commandtype":"addtrigger.","success":"true","data":{"ruleid":"<ruleid>"}
 
}
 
<br />
 
Failure<br />
 
1 - {  "mii":"<random key>", "commandtype":"addtrigger.","success":"false","data":{"ruleid":"<ruleid>"}}
 
2 - {  "mii":"<random key>", "commandtype":"addtrigger.","success":"false"}
 
<br />
 
Example<br />
 
In the following example, a Device with device id=1, device index=1 and indexvalue=’true’ is added as a trigger for rule with ruleid=1.<br />
 
 
  "mii":"idcidf",
 
  "cmd":"addtrigger",
 
  "ruleid":"1",
 
  "triggertype":"DeviceTrigger",
 
  "deviceid":"1",
 
  "deviceindex":"1",
 
  "indexvalue":"true",
 
  "grouping":"AND",
 
  "condition":"eq",
 
  "duration":"50"
 
}
 
<br />
 
Response
 
{
 
  "mii":"idcidf", "commandtype":"addtrigger.","success":"true","data":{"ruleid":"1"}
 
}
 
====EventTrigger====
 
Command to add an event based trigger in a rule<br />
 
Request
 
 
  "mii":"<random key>",
 
  "cmd":"addtrigger",
 
  "ruleid":"<ruleid>",
 
  "triggertype":"<type of trigger>",
 
  "eventid":"<event id>",
 
  "eventtype":"<event type>",
 
  "eventval":"<event value>",
 
  "grouping":"< AND/OR>",
 
  "condition":"<condition type ie.eq/le/ge/lt/gt>",
 
  "duration":"<time in sec>"
 
}
 
<br />
 
Response<br />
 
Success
 
 
  {
 
  {
  "mii":"<random key>", "commandtype":"addtrigger.","success":"true","data":{"ruleid":"<ruleid>"}
+
    "MobileInternalIndex": "111",
 +
    "CommandType": "UpdateRule",
 +
    "Name": "ruleNAME",     
 +
    "Valid":"true",
 +
    "ID": "2",
 +
    "Triggers": [
 +
        {
 +
            "Type": "<type of trigger>",
 +
            "ID": "<device id>",
 +
            "Index": "<device index>",
 +
            "Value": "<index value>",
 +
            "Grouping": "< AND/OR>",
 +
            "Condition": "<condition type ie.eq/le/ge/lt/gt>",
 +
            "Duration": "<time in sec>",
 +
            "Valid":"true"
 +
        },
 +
        {
 +
            "Type": "<type of trigger>",
 +
            "ID": "<event id>",
 +
            "EventType": "<event type>",
 +
            "Value": "<event value>",
 +
            "Grouping": "<AND/OR>",
 +
            "Condition": "<condition type ie.eq/le/ge/lt/gt>",
 +
            "Duration": "<time in sec>",
 +
            "Valid":"true"
 +
        }
 +
    ],
 +
    "Results": [
 +
        {
 +
            "Type": "<type of result>",
 +
            "ID": "<device id>",
 +
            "Index": "<device index>",
 +
            "Value": "<index value>",
 +
            "PreDelay": "<time in sec>"
 +
        },
 +
        {
 +
            "Type": "<type of result>",
 +
            "ID": "<event id>",
 +
            "EventType": "<event type>",
 +
            "Value": "<event value>",
 +
            "PreDelay": "<time in sec>"
 +
        }
 +
    ]
 
  }
 
  }
Failure
+
 
1 - {"mii":"<random key>", "commandtype":"addtrigger.","success":"false","data":{"ruleid":"<ruleid>"}}
+
2 - {"mii":"<random key>", "commandtype":"addtrigger.","success":"false"}
+
 
<br />
 
<br />
Example
 
In the following example, an event with  event id 1,  eventtype as AlmondModeUpdated and eventvalue as home is added as a trigger to rule with ruleid 2.<br />
 
 
  "mii":"udfh",
 
  "cmd":"addtrigger",
 
  "ruleid":"2",
 
  "triggertype":"EventTrigger",
 
  "eventid":"1",
 
  "eventtype":"AlmondModeUpdated",
 
  "eventval":"home",
 
  "grouping":"AND",
 
  "condition":"eq",
 
  "duration":"50"
 
}
 
<br />
 
Response
 
 
  "mii":"udfh", "CommandType":"addtrigger.","success":"true","data":{"ruleid":"2"}
 
}
 
<br />
 
====TimeTrigger====
 
Command to add a time based trigger.<br />
 
Request
 
 
  "mii":"<random key>",
 
  "cmd":"addtrigger",
 
  "ruleid":"<ruleid>",
 
  "triggertype":"<type of trigger>",
 
  "hours":"<hours>",
 
  "mins":"<minutes>",
 
  "dayofmonth":"<1-31,*>",
 
  "monthofyear":"<0-11,*>",
 
  "dayofweek":"<0-6,*>",
 
  "grouping":"< AND/OR>",
 
  "range":"<time in min>"
 
}
 
 
Response<br />
 
Response<br />
Success
 
{
 
  "mii":"<random key>","commandtype":"addtrigger.","success":"true","data":{"ruleid":"<ruleid>"}
 
}
 
Failure
 
1 - {"mii":"<random key>","commandtype":"addtrigger.","success":"false","data":{"ruleid":"<ruleid>"}}
 
2 - {"mii":"<random key>","commandtype":"addtrigger.","success":"false"}
 
<br />
 
Example<br />
 
In the following example, a timetrigger with hours=1 ,min=10 and range=50 is added to the rule with ruleid=2.<br />
 
 
  {   
 
  {   
  "mii":"jdfvg",
+
    "CommandType":"UpdateRule",
  "cmd":"addtrigger",
+
    "Success":"true",
  "ruleid":"2",
+
    "MobileInternalIndex":"111",
  "triggertype":"TimeTrigger",
+
    "ReasonCode":"1"
  "hours":"1",
+
  "mins":"10",
+
  "dayofmonth":"*",
+
  "monthofyear":"*",
+
  "dayofweek":"1,2,3",
+
  "grouping":"AND",
+
  "range":"50"
+
}
+
Response
+
{
+
  "mii":"jdfvg","CommandType":"addtrigger.","success":"true","data":{"ruleid":"2"}
+
 
  }
 
  }
 
<br />
 
<br />
===Removetrigger===
+
 
Command to remove a trigger in a rule.<br />
+
===Removerule===
Request
+
Command to remove an existing rule.<br />
{
+
  "mii":"<random key>",
+
  "cmd":"removetrigger",
+
  "ruleid":"<ruleid>",
+
  "triggerid":"<triggerid>"
+
}
+
Response<br />
+
Success
+
{
+
  "mii":"<random key>", "commandtype":"removetrigger.","success":"true","data":{"ruleid":"<ruleid>" ,"triggerid":"<triggerid>"}
+
}
+
<br />
+
Failure
+
1 - {"mii":"<random key>","commandtype":"removetrigger.""success":"false","data":{"ruleid":"<ruleid>" ,"triggerid":"<triggerid>"}}
+
2 - {"mii":"<random key>","commandtype":"removetrigger.","success":"false"}
+
<br />
+
Example<br />
+
In the following example, a trigger with triggerid 1 is removed from ruleid 2.<br />
+
{
+
  "mii":"yvgedc",
+
  "cmd":"removetrigger",
+
  "ruleid":"2",
+
  "triggerid":"1"
+
}
+
<br />
+
Response<br />
+
{
+
  "mii":"yvgedc","commandtype":"removetrigger.","success":"true","data":{"ruleid":"2" ,"triggerid":"1"}
+
}
+
===Removealltriggers===
+
Command to remove all triggers in a rule.<br />
+
 
Request<br />
 
Request<br />
 
  "mii":"<random key>",
 
  "cmd":"removealltriggers",
 
  "ruleid":"<ruleid>"
 
}
 
<br />
 
Response<br />
 
Success
 
 
  {
 
  {
   "mii":"<random key>","commandtype":"removealltriggers.","success":"true","data":{"ruleid":"<ruleid>"}
+
   "CommandType": "RemoveRule",
}
+
  "Rules": {
Failure
+
  "ID": "1"
1 - {"mii":"<random key>","commandtype":"removealltriggers.","success":"false","data":{"ruleID":"<ruleid>"}}
+
  },
  2 - {"mii":"<random key>","commandtype":"removealltriggers.","success":"false"}
+
  "MobileInternalIndex": "111"
<br />
+
Example<br />
+
In the following command, all triggers from ruleid 1 are removed<br />
+
+
  "mii":"dfnc",
+
  "cmd":"removealltriggers",
+
  "ruleid":"1"
+
 
  }
 
  }
 
<br />
 
<br />
 
Response<br />
 
Response<br />
 
  {
 
  {
   "mii":"dfnc","commandtype":"removealltriggers.","success":"true","data":{"ruleid":"1"}
+
   "CommandType":"RemoveRule",
 +
  "Success":"true",
 +
  "MobileInternalIndex":"111",
 +
  "ReasonCode":"0"
 
  }
 
  }
 
<br />
 
<br />
===Addresult===
+
 
Results are the actions performed when a rule is triggered. Following set of commands can be used to add different types of results to a rule.<br />
+
 
====DeviceResult====
+
===Removeallrules===
Command to add DeviceResult to a rule.<br />
+
Command to remove all rules.<br />
 
Request<br />
 
Request<br />
{
 
  "mii":"<random key>",
 
  "cmd":"addresult",
 
  "ruleid":"<ruleid>",
 
  "resulttype":"<type of result>",
 
  "deviceid":"<device id>",
 
  "deviceindex":"<device index>",
 
  "indexvalue":"<index value>",
 
  "predelay":"<time in sec>"
 
}
 
Response<br />
 
Success
 
 
  {
 
  {
   "mii":"<random key>","commandtype":"addresult ","success":"true","data":{"ruleid":"<ruleid>"}
+
   "CommandType":"RemoveAllRules",
 +
  "MobileInternalIndex":"111"
 
  }
 
  }
Failure
 
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
 
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
 
 
<br />
 
<br />
Example
 
In the following example, a DeviceResult is added to rule with ruleid=2.<br />
 
 
  "mii":"rteyuwio#$%^",
 
  "cmd":"addresult",
 
  "ruleid":"2",
 
  "resulttype":"DeviceResult",
 
  "deviceid":"2",
 
  "deviceindex":"1",
 
  "indexvalue":"true",
 
  "predelay":"10"
 
}
 
 
Response<br />
 
Response<br />
 
  {
 
  {
   "mii":"teyuwio#$%^","commandtype":"addresult ","success":"true","data":{"ruleid":"2"}
+
   "CommandType":"RemoveAllRules",
}
+
  "Success":"true",
====EventResult====
+
   "MobileInternalIndex":"111",
Command to add an EventResult to a rule.<br />
+
   "ReasonCode":"0"
Request
+
}
{
+
  "mii":"<random key>",
+
  "cmd":"addresult",
+
  "ruleid":"<ruleid>",
+
  "resulttype":"<type of result>",
+
  "eventid":"<event id>",
+
  "eventtype":"<event type>",
+
  "eventval":"<event value>",
+
  "predelay":"<time in sec>"
+
}
+
Response<br />
+
Success
+
{
+
  "mii":"<random key>","commandtype":"addresult ","success":"true","data":{"ruleid":"<ruleid>"}
+
}
+
Failure
+
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
+
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
+
Example<br />
+
In the following example, an EventResult is added to a rule with ruleid=2.<br />
+
{
+
  "mii":"ertyulkjhgf",
+
  "cmd":"addresult",
+
  "ruleid":"2",
+
  "resulttype":"EventResult",
+
  "eventid":"1",
+
  "eventtype":"AlmondModeUpdated",
+
  "eventval":"home",
+
  "predelay":"10"
+
}
+
Response
+
{
+
  "mii":"ertyulkjhgf","commandtype":"addresult ","success":"true","data":{"ruleid":"2"}
+
}
+
====SceneResult====
+
Command to add SceneResult to rule.<br />
+
Request
+
+
  "mii":"<random key>",
+
  "cmd":"addresult",
+
  "ruleid":"<ruleid>",
+
  "resulttype":"SceneResult",
+
   "sceneid":"<sceneid>",
+
   "predelay":"<time in sec>"
+
}
+
 
<br />
 
<br />
Response<br />
+
 
Success
+
 
 +
===Validaterule===
 +
Command to validate an existing rule.<br />
 +
Request<br />
 
  {
 
  {
   "mii":"<random key>","commandtype":"addresult ","success":"true","data":{"ruleid":"<ruleid>"}
+
   "CommandType":"ValidateRule",
}
+
   "ID":"1",
Failure
+
   "Value":"true"
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
+
   "MobileInternalIndex":"111"
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
+
<br />
+
====NetworkResult====
+
Command to add NetworkResult to rule.<br />
+
Request
+
+
   "mii":"<random key>",
+
  "cmd":"addresult",
+
  "ruleid":"<ruleid>",
+
  "resulttype":"NetworkResult",
+
  "networkid":"1",
+
   "networkvalue":"reboot",
+
   "predelay":"<time in sec>"
+
 
  }
 
  }
 
<br />
 
<br />
 
Response<br />
 
Response<br />
Success
 
 
  {
 
  {
  "mii":"<random key>","commandtype":"addresult ","success":"true","data":{"ruleid":"<ruleid>"}
+
  "CommandType":"ValidateRule",
 +
  "MobileInternalIndex":"111",
 +
  "ReasonCode":"0",
 +
  "Success":"false",
 +
  "Data":{
 +
  "Value":"true",
 +
  "ID":"1"
 
  }
 
  }
Failure
 
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
 
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
 
===Removeresult===
 
Command to remove result in a rule.<br />
 
Request
 
{
 
  "mii":"<random key>",
 
  "cmd":"removeresult",
 
  "ruleid":"<ruleid>",
 
  "resultid":"<resultid>"
 
 
  }
 
  }
 
<br />
 
<br />
Response<br />
 
Success
 
{
 
  "mii":"<random key>","commandtype":"removeresult","success":"true","data":{"ruleid":"<ruleid>", "resultid":"<resultid>"}
 
}
 
Failure
 
1-{"mii":"<random key>","commandtype":"removeresult","success":"false","data":{"ruleid":"<ruleid>","resultid":"<resultid>"}}
 
2 - {"mii":"dfnc","commandtype":"removeresult","success":"false"}
 
Example
 
In the following example, a result with  resultid=2 is removed from rule with ruleid=2<br />
 
 
  "mii":"87984651",
 
  "cmd":"removeresult",
 
  "ruleid":"2",
 
  "resultid":"2"
 
}
 
Response
 
{
 
  "mii":"87984651","commandtype":"removeresult","success":"true","data":{"ruleid":"2", "Result":"2"}
 
}
 
  
===Removeallresults===
 
Command to remove all results in a rule.<br/>
 
Request
 
 
  "mii":"<random key>",
 
  "cmd":"removeallresults",
 
  "ruleid":"<ruleid>"
 
}
 
Response
 
Success
 
{
 
  "mii":"<random key>","commandtype":"removeallresults","success":"true","data":{"ruleid":"<ruleid>"}
 
}
 
Failure
 
  {"mii":"<random key>","commandtype":"removeallresults","success":"false","data":{"ruleid":"<ruleid>"}}
 
  {"mii":"<random key>","commandtype":"removeallresults","success":"false"}
 
Example<br/>
 
In the following example, all results are removed from rule with ruleid=2.<br/>
 
 
  "mii":"teoncwsi",
 
  "cmd":"removeallresults",
 
  "ruleid":"2"
 
}
 
Response<br/>
 
{
 
  "mii":"teoncwsi","commandtype":"removeallresults","success":"true","data":{"ruleid":"2"}
 
}
 
<br/>
 
===Validaterule===
 
Command to enable or disable a rule.<br/>
 
Request
 
 
  "mii":"<random key>",
 
  "cmd":"validaterule",
 
  "ruleid":"<ruleid>",
 
  "value":"<value>"
 
}
 
Response<br/>
 
Success<br/> 
 
If rule is valid<br/>
 
{
 
  "mii":"<random key>","commandtype":"validaterule","success":"true","data":{"value":"true","ruleid":"<ruleid>"}
 
}
 
<br/>
 
If rule is invalid<br/>
 
{
 
  "mii":"<random key>","commandtype":"validaterule","success":"true","data":{"value":"false","ruleid":"<ruleid>"}
 
}
 
  
Failure<br/>
+
==ClientList==
{"mii":"<random key>","commandtype":"validaterule","success":"false","data":{"ruleid":"<ruleid>"}}}
+
{"mii":"<random key>","commandtype":"validaterule","success":"false"}
+
 
+
===Setpredelay===
+
When a rule is triggered, the action can be delayed by adding a ‘predelay’ to the result in the rule. ‘Setpredelay’ command can be used to specify a predelay for a particular resultid in a rule.<br/>
+
Request
+
+
  "mii":"<random key>",
+
  "cmd":"setpredelay",
+
  "ruleid":"<ruleid>",
+
  "resultid":"<resultid>"
+
}
+
Response<br/>
+
Success
+
{
+
  "mii":"<random key>","commandtype":"setpredelay","success":"true","data":{"ruleid":”<ruleid>"}
+
}
+
Failure
+
1 - {"mii":"<random key>","commandtype":"setpredelay","success":"false","data":{"ruleid":”<ruleid>"}}
+
2 - {"mii":"<random key>","commandtype":"setpredelay","success":"false"}
+
 
+
===Setrulename===
+
Command to change the name of an existing rule.<br/>
+
Request
+
+
  "mii":"<random key>",
+
  "cmd":"setrulename",
+
  "ruleid":"<ruleid>",
+
  "rulename":"<name of rule>"
+
}
+
Response<br/>
+
Success
+
{
+
  "mii":"<random key>","commandtype":"setrulename","success":"true","data":{"ruleid":"<ruleid>","rulename":"<nameof rule>}
+
}
+
Failure
+
1-{"mii":"<random key>","commandtype":"setrulename","success":"false","data":{"ruleid":"<ruleid>,"rulename":"<name of rule>"}}
+
2 - {"mii":"<random key>","commandtype":"setrulename","success":"false"}
+
 
+
Example
+
In the following example, a new name is set to the rule with ruleid=2.<br/>
+
+
  "mii":"uopup",
+
  "cmd":"setrulename",
+
  "ruleid":"2",
+
  "rulename":"newname"
+
}
+
Response
+
{
+
  "mii":"uopup","commandtype":"setrulename","success":"true","data":{"ruleid":"2","rulename":"newname}}
+
}
+
 
+
===Deleteallrules===
+
Command to delete all rules.<br/>
+
Request
+
+
  "mii":"<random key>",
+
  "cmd":"deleteallrules",
+
}
+
Response<br/>
+
{"mii":"<random key>","commandtype":"deleteallrules","success":"true"}
+
 
+
===Newrule===
+
command to create a new rule.<br/>
+
Request
+
+
  "mii":"<random key>",
+
  "cmd":"newrule",
+
  "rulename":"<rulename>",
+
  "triggers":"<num of triggers>",
+
  "trigger":{ 
+
    "1":{ 
+
      "triggertype":"<type of trigger>",
+
      "deviceid":"<device id>",
+
      "deviceindex":"<device index>",
+
      "indexvalue":"<index value>",
+
      "grouping":"< AND/OR>",
+
      "condition":"<condition type ie.eq/le/ge/lt/gt>",
+
      "duration":"<time in sec>"
+
    },
+
    "2":{ 
+
      "triggertype":"<type of trigger>",
+
      "eventid":"<event id>",
+
      "eventtype":"<event type>",
+
      "eventval":"<event value>",
+
      "grouping":"<AND/OR>",
+
      "condition":"<condition type ie.eq/le/ge/lt/gt>",
+
    "duration":"<time in sec>"
+
    }
+
    },
+
    "results":"<num of results>",
+
    "result":{ 
+
    "1":{ 
+
      "resulttype":"<type of result>",
+
      "deviceid":"<device id>",
+
      "deviceindex":"<device index>",
+
      "indexvalue":"<index value>",
+
      "predelay":"<time in sec>"
+
    },
+
    "2":{ 
+
      "resulttype":"<type of result>",
+
      "eventid":"<event id>",
+
      "eventtype":"<event type>",
+
      "eventval":"<event value>",
+
      "predelay":"<time in sec>"
+
    }
+
  }
+
  }
+
Response<br/>
+
Success
+
{"mii":"<random key>","commandtype":"newrule","success":"true"}
+
Failure
+
{"mii":"<random key>","commandtype":"newrule","success":"false"}
+
<br/>
+
Example
+
Following example demonstrates creating new rule with name “myrule”. It has 2 triggers, 1st trigger is DeviceTrigger and 2nd is EventTrigger and it has 2 results, 1st result is DeviceResult and 2nd is EventResult.<br/>
+
+
  "mii":"87y68gdr",
+
  "cmd":"newrule",
+
  "rulename":"myrule",
+
  "triggers":"2",
+
  "trigger":{ 
+
    "1":{ 
+
      "triggertype":"DeviceTrigger",
+
      "deviceid":"6",
+
      "deviceindex":"1",
+
      "indexvalue":"true",
+
      "grouping":"AND",
+
      "condition":"eq"
+
    },
+
    "2":{ 
+
      "triggertype":"EventTrigger",
+
      "eventid":"1",
+
      "eventtype":"AlmondModeUpdated",
+
      "eventval":"home",
+
      "grouping":"AND",
+
      "condition":"eq"
+
    }
+
  },
+
  "results":"2",
+
  "result":{ 
+
    "1":{ 
+
      "resulttype":"DeviceResult",
+
      "deviceid":"6",
+
      "deviceindex":"1",
+
      "indexvalue":"false",
+
      "predelay":"2"
+
    },
+
    "2":{ 
+
      "resulttype":"EventResult",
+
      "eventid":"1",
+
      "eventtype":"AlmondModeUpdated",
+
      "eventval":"away",
+
      "predelay":"2"
+
    }
+
  }
+
}
+
 
+
Response<br/>
+
{"mii":"87y68gdr","commandtype":"newrule","success":"true"}
+
 
+
===Editrule===
+
Command to edit existing rule.<br/>
+
Request
+
{
+
  "mii":"<random key>",
+
  "cmd":"editrule",
+
  "ruleid":"<rule id>",
+
  "rulename":"<rule name>",
+
  "triggers":"<num of triggers>",
+
  "trigger":{ 
+
    "1":{ 
+
      "triggertype":"<type of trigger>",
+
      "deviceid":"<device id>",
+
      "deviceindex":"<device index>",
+
      "indexvalue":"<index value>",
+
      "grouping":"<AND/OR>",
+
      "condition":"<condition type ie.eq/le/ge/lt/gt>"
+
      "duration":"<time in sec>"
+
      },
+
    "2":{ 
+
      "triggertype":"<type of trigger>",
+
      "eventid":"<event id>",
+
      "eventtype":"<event type>",
+
      "eventval":"<event value>",
+
      "grouping":"<AND/OR>",
+
      "condition":"<condition type ie.eq/le/ge/lt/gt>"
+
    "duration":"<time in sec>"
+
      }
+
    },
+
  "results":"<num of results>",
+
  "result":{ 
+
    "1":{ 
+
      "resulttype":"<type of result>",
+
      "deviceid":"<device id>",
+
      "deviceindex":"<device index>",
+
      "indexvalue":"<index value>",
+
      "predelay":"<time in sec>"
+
    },
+
    "2":{ 
+
      "resulttype":"<type of event>",
+
      "eventid":"<event id>",
+
      "eventtype":"<event type>",
+
      "eventval":"<event value>",
+
      "predelay":"<time in sec>"
+
    }
+
  }
+
}
+
Response<br/>
+
Success
+
{"<random key>":"dfnc","commandtype":"editrule","success":"true"}
+
Failure
+
{"mii":"<random key>","commandtype":"editrule","success":"false"}
+
<br/>
+
Example
+
Following example demonstrates editing rule with ruleid=1, and name “changingrulename”. It has 2 triggers, 1st trigger is DeviceTrigger and 2nd is EventTrigger and it has 2 results, 1st result is DeviceResult and 2nd is EventResult.<br/>
+
{
+
  "mii":"dhcb",
+
  "cmd":"editrule",
+
  "ruleid":"1",
+
  "rulename":"changingrulename",
+
  "triggers":"2",
+
  "trigger":{ 
+
    "1":{ 
+
      "triggertype":"DeviceTrigger",
+
      "deviceid":"7",
+
      "deviceindex":"1",
+
      "indexvalue":"true",
+
      "grouping":"AND",
+
      "condition":"eq"
+
    },
+
    "2":{ 
+
      "triggertype":"EventTrigger",
+
      "eventid":"1",
+
      "eventtype":"AlmondModeUpdated",
+
      "eventval":"home",
+
      "grouping":"AND",
+
      "condition":"eq"
+
    }
+
  },
+
  "results":"2",
+
  "result":{ 
+
    "1":{ 
+
      "resulttype":"DeviceResult",
+
      "deviceid":"6",
+
      "deviceindex":"1",
+
      "indexvalue":"false",
+
      "predelay":"2"
+
    },
+
    "2":{ 
+
      "resulttype":"EventResult",
+
      "eventid":"1",
+
      "eventtype":"AlmondModeUpdated",
+
      "eventval":"away",
+
      "predelay":"2"
+
    }
+
  }
+
}
+
 
+
Response
+
{"mii":"dhcb","commandtype":"editrule","success":"true"}
+
== Clients Commands ==
+
Note: mii (MobileInternalIndex) is a random key that is generated by the client and should be used for matching the received response to the corresponding request. Maximum string length of mii is 32 characters.
+
A unique mii should be used for each request<br/>
+
 
+
===ClientList===
+
 
Command to get clientlist.<br/>
 
Command to get clientlist.<br/>
 
Request
 
Request
Line 890: Line 423:
  
 
Response
 
Response
  {
+
  {
  "MobileInternalIndex":"<random key>",
+
        "CommandType": "ClientList",
  "CommandType":"ClientList",
+
        "MobileInternalIndex":"<random key same as request>",
  "Success":"true",
+
        "Success":"true",
  "Clients":
+
        "Clients": {
    {
+
              "1": {
      "ID":"1",
+
                        "ID":"1",
      "Name":"iphone_4s",
+
                        "Name": "64:bc:0c:80:62:46",
      "Connection":"wireless",
+
                        "Connection": "wired",
      "MAC":"other",
+
                        "MAC": "64:bc:0c:80:62:46",
      "Type":"other",
+
                        "Type": "other",
      "LastKnownIP":"10.2.2.11",
+
                        "LastKnownIP": "10.10.10.97",
      "Active":"false",
+
                        "Active": "false",
      "UseAsPresence":"true",
+
                        "UseAsPresence": "true",
      "LastActiveEpoch":"1433920922",
+
                        "Wait": "6",
      "Wait":"6"
+
                        "LastActiveEpoch": "1459845389",
    },
+
                        "RX": "0",
    {
+
                        "TX": "0",
      "ID":"2",
+
                        "Block": "0/1/2",
      "Name":"buildserver.lan",
+
                        "CanBlock":"true/false",
      "Connection":"wired",
+
                        "Category":"Kids/Others",
      "MAC":"d8:50:e6:54:1b:9c",
+
                        "Schedule": "0,0,0,0,0,0,0",
      "Type":"other",
+
                        "Manufacturer": "LG",
      "LastKnownIP":"10.10.10.1",
+
                        "RSSI": "0",
      "Active":"true",
+
                        "ForceInActive": "0"
      "UseAsPresence":"false",
+
                },
      "LastActiveEpoch":"1433920922",
+
                "2": {
      "Wait":"6"
+
                        "ID":"2",
    }
+
                        "Name": "64:bc:0c:80:62:46",
  ]
+
                        "Connection": "wired",
 +
                        "MAC": "64:bc:0c:80:62:46",
 +
                        "Type": "other",
 +
                        "LastKnownIP": "10.10.10.97",
 +
                        "Active": "false",
 +
                        "UseAsPresence": "true",
 +
                        "Wait": "6",
 +
                        "LastActiveEpoch": "1459845389",
 +
                        "RX": "0",
 +
                        "TX": "0",
 +
                        "Block": "0",
 +
                        "Schedule": "0,0,0,0,0,0,0",
 +
                        "Manufacturer": "LG",
 +
                        "RSSI": "0",
 +
                        "ForceInActive": "0"
 +
                }
 +
        }
 
  }
 
  }
  
Line 949: Line 498:
 
         other
 
         other
  
Use As Presence - true/false<br/>
+
Use as Presence - true/false<br/>
Request<br/>
+
Request<br/>
+
  "MobileInternalIndex":"<random key>",
+
  "CommandType":"UpdateClient",
+
  "Clients":{ 
+
    "ID":"2",
+
    "Name":"device1",
+
    "Connection":"wired",
+
    "MAC":"00:17:88:0a:04:41",
+
    "Type":"tv",
+
    "LastKnownIP":"10.2.2.11",
+
    "Active":"false",
+
    "UseAsPresence":"false",
+
    "Wait":"6"
+
 
+
  }
+
}
+
 
+
Response<br/>
+
Success
+
 
  {
 
  {
  "CommandType":"UpdateClient",
+
        "CommandType":"UpdateClient",
  "MobileInternalIndex":"324",
+
        "Clients":{
  "Success":"true",
+
          "ID": "1",
  "ReasonCode":"0"
+
          "Name": "device1",
 +
          "Connection": "wired",
 +
          "MAC": "1c:75:08:32:2a:6d",
 +
          "Type": "other",
 +
          "LastKnownIP": "10.2.2.11",
 +
          "Active": "false",
 +
          "UseAsPresence": "false",
 +
          "Wait":"6",
 +
          "Block":"0/1/2",
 +
          "Category":"Kids/Others"
 +
        },
 +
        "MobileInternalIndex":"324"
 
  }
 
  }
Faliure
+
Response<br/>
 
  {
 
  {
   "CommandType":"UpdateClient",
+
   "Success":"true/false",
 
   "MobileInternalIndex":"324",
 
   "MobileInternalIndex":"324",
  "Success":"false",
 
 
   "ReasonCode":"0"
 
   "ReasonCode":"0"
 
  }
 
  }
Line 1,001: Line 541:
 
   "MobileInternalIndex":"324",
 
   "MobileInternalIndex":"324",
 
   "Success":"true",
 
   "Success":"true",
   "ReasonCode":"0"  
+
   "Reason":"0"  
 
  }
 
  }
 
Failure
 
Failure
Line 1,008: Line 548:
 
   "MobileInternalIndex":"324",
 
   "MobileInternalIndex":"324",
 
   "Success":"false",
 
   "Success":"false",
   "ReasonCode":"0"
+
   "Reason":"0"
 
  }
 
  }
  
Line 1,034: Line 574:
 
  }
 
  }
 
<br/>
 
<br/>
 +
 
==ScenesCommands==
 
==ScenesCommands==
 
Note:mii(MobileInternalIndex) is a random key that is generated by the client and should be used for matching the received response to the corresponding request. Maximum string length of mii is 32 characters.
 
Note:mii(MobileInternalIndex) is a random key that is generated by the client and should be used for matching the received response to the corresponding request. Maximum string length of mii is 32 characters.
Line 1,041: Line 582:
 
Command to retrieve the list of existing Scenes.<br/>
 
Command to retrieve the list of existing Scenes.<br/>
 
Request
 
Request
  {  
+
  {
   "MobileInternalIndex":"<random key>",
+
   "CommandType":"DynamicSceneList",
   "CommandType":"DynamicSceneList"
+
   "MobileInternalIndex":"5432857"
 
  }
 
  }
 
 
Response<br/>
 
Response<br/>
 
Note: Active :- Indicates the state of Scene<br/>
 
Note: Active :- Indicates the state of Scene<br/>
  {
+
  {
  "MobileInternalIndex":"<random key>",
+
        "CommandType": "DynamicSceneList",
  "CommandType":"DynamicSceneList",
+
        "MobileInternalIndex":"<same as in request>",
  "Scenes":
+
        "Scenes": {
    {
+
                "1": {
      "ID":"1",
+
                        "ID":"1",
      "Name":"Scene1",
+
                        "Active": "true",
      "LastActiveEpoch":"1433740885",
+
                        "Name": "Scene1022",
      "Active":"false",
+
                        "LastActiveEpoch": "251176214925585",
      "SceneEntryList":[
+
                        "VoiceCompatible":"true",
        {
+
                        "SceneEntryList": [{
          "DeviceID":"2",
+
                                "ID": "2",
          "Index":"2",
+
                                "Index": "1",
          "Value":"true",
+
                                "Value": "false",
          "Valid":"false"
+
                                "Valid": "true"
        },
+
                        }, {
        {
+
                                "ID": "4",
          "DeviceID":"1",
+
                                "Index": "1",
          "Index":"2",
+
                                "Value": "78",
          "Value":"true",
+
                                "Valid": "true"
          "Valid":"false"
+
                        }]
 +
                }
 
         }
 
         }
      ]
 
    },
 
    { 
 
      "ID":"2",
 
      "Name":"Scene2",
 
      "LastActiveEpoch":"0",
 
      "Active":"false",
 
      "SceneEntryList":[ 
 
        { 
 
          "DeviceID":"6",
 
          "Index":"1",
 
          "Value":"true",
 
          "Valid":"false"
 
        },
 
        { 
 
          "DeviceID":"7",
 
          "Index":"1",
 
          "Value":"true",
 
          "Valid":"false"
 
        }
 
      ]
 
    }
 
  ]
 
 
  }
 
  }
 +
 
===AddScene===
 
===AddScene===
 
Command to add a new Scene.<br/>
 
Command to add a new Scene.<br/>
 
Request
 
Request
  {
+
  {
  "CommandType":"AddScene",
+
"CommandType": "AddScene",
  "MobileInternalIndex":"324",
+
"MobileInternalIndex": "324",
  "Scenes":{
+
"Scenes":{
    "Name":"My_created_scene",
+
"Name": "My_created_scene",
    "SceneEntryList":[
+
"SceneEntryList": [
      {  
+
  {
        "DeviceID":"1",
+
"ID": "1",
        "Index":"1",
+
"Index": "1",
        "Value":"false"
+
"Value": "false"
      },
+
},
      {  
+
  {
        "DeviceID":"2",
+
"ID": "2",
        "Index":"2",
+
"Index": "2",
        "Value":"false"
+
"Value": "false"
      }
+
}
    ]
+
]}
  }
+
  }
  }  
+
  
 
Response
 
Response
  {"CommandType":"AddScene","MobileInternalIndex":"324","Success":"true","Reason":"0"}
+
  {
 +
"CommandType":"AddScene",
 +
"MobileInternalIndex":"324",
 +
"ReasonCode":"0",
 +
"Success":"true"
 +
}
  
 
===UpdateScene===
 
===UpdateScene===
 
Command to update an existing Scene<br/>
 
Command to update an existing Scene<br/>
 
Request
 
Request
  {   
+
  {
  "CommandType":"UpdateScene",
+
  "MobileInternalIndex": 1667509461,
  "MobileInternalIndex":"324",
+
"Scenes": {
  "Scenes":{   
+
  "Name": "DADad222d",
    "ID":"15",
+
"ID": 1,
    "Name":"My_created_scene",
+
"SceneEntryList": [{
    "SceneEntryList":[
+
  "ID": 0,
      {   
+
"Value": "home",
        "DeviceID":"1",
+
"Index": 1
        "Index":"1",
+
}, {
        "Value":"false"
+
"ID": 2,
      },
+
"Value": "false",
      {   
+
"Index": 1
        "DeviceID":"2",
+
}, {
        "Index":"2",
+
  "ID": 2,
        "Value":"false"
+
"Value": "true",
      }
+
"Index": 2
    ]
+
}],
  }
+
"VoiceCompatible": false
 +
},"CommandType": "UpdateScene"
 
  }
 
  }
 
 
Response
 
Response
  {"CommandType":"UpdateScene","MobileInternalIndex":"324","Success":"true","Reason":"0"}
+
  {"MobileInternalIndex":"324",
 +
"ReasonCode":"0",
 +
"Success":"true"
 +
}
  
 
===ActivateScene===
 
===ActivateScene===
Line 1,187: Line 713:
 
==Notification and Event Updates==
 
==Notification and Event Updates==
  
===SensorUpdate===
+
===DynamicIndexUpdated===
When any index value is changed the following update will be received.<br/>
+
If any device index is changed, the following update will be received.  
{"commandtype":"SensorUpdate","data":{"<device id>":{"<index id>":{"index":"<index id>","name":"<index name>","value":"<index value>"}}}}
+
Example
+
{"commandtype":"SensorUpdate","data":{"25":{"3":{"index":"3","name":"TAMPER","value":"false"}}}}
+
  
===DeviceAdded===
+
  {
When a new device is added the following update will be received.
+
  "CommandType":"DynamicIndexUpdated",
  {"commandtype":"DeviceAdded","data":{"<device id>":{"devicename":"<device name>","friendlydevicetype":"<friendly device type name >","devicetype":"<device type id >","deviceid":"<device id >","location":"
+
  "Devices":{
  <location>","devicevalues":{"1":{"index":"<index num>","name":"<index name >","value":"<index val>"},"2":{"index":"<index num>","name":"<index name>","value":"<index val>"},"3":{"index":"<index num>","name":"<index
+
      "<device id>":{  
name>","value":"<index val>"}}}}}
+
        "DeviceValues":{
Example:
+
                "<index id>":{ 
{"commandtype":"DeviceAdded","data":{"27":{"devicename":"ContactSwitch #27","friendlydevicetype":"ContactSwitch","devicetype":"12","deviceid":"27","location":"Default","devicevalues":{"1":  
+
                    "Name":"<index name>",
{"index":"1","name":"STATE","value":"true"},"2":{"index":"2","name":"LOW BATTERY","value":"0"},"3":{"index":"3","name":"TAMPER","value":"true"}}}}}
+
                    "Value":"<index value>"
 +
                }
 +
        }
 +
      }
 +
  }
 +
}
 +
===DynamicDeviceAdded===
 +
Whenever a device is added, the follow update would be received.
 +
 +
 +
  "CommandType":"DynamicDeviceAdded",
 +
  "Devices":{  
 +
      "<device id>":{  
 +
        "Data":{
 +
                  "Name":"<device name>",
 +
                  "Type":"<device type id >",
 +
                  "FriendlyDeviceType":"<friendly device type>",
 +
                  "Location":"<location>",
 +
                  "LastActiveEpoch":"<time stamp>",  
 +
                  "Manufacturer":"<manufacturer name>",
 +
                  "Version":"<version number>",
 +
                  "Model":"<model>",
 +
                  "DeviceState":"<0/1/2>"
 +
                },
 +
        "DeviceValues":{
 +
            "1":{
 +
              "Name":"<index name >",
 +
              "Value":"<index val>",
 +
              "Type":"<index type>"
 +
            },
 +
            "2":{
 +
              "Name":"<index name>",
 +
              "Value":"<index val>",
 +
              "Type":"<index type>"
 +
            },
 +
            "3":{
 +
              "Name":"<index name>",
 +
              "Value":"<index val>",
 +
              "Type":"<index type>"
 +
            }
 +
        }
 +
      }
 +
  }
 +
}
 +
===DynamicDeviceRemoved===
 +
Whenever a device is removed, the following update is received.
 +
 +
 +
  "CommandType":"DynamicDeviceRemoved",
 +
  "Action":"remove",
 +
  "Devices":{
 +
  "25":{
 +
    "Type":"<device type id >"}
 +
  }
 +
}
  
===DeviceRemoved===
+
===DynamicAllDevicesRemoved===
When a device is removed the following update will be received
+
{"commandtype":"DeviceRemoved","data":{"<device id>":{"devtype":"<device type>"}}}
+
Example
+
{"commandtype":"DeviceRemoved","data":{"25":{"devtype":"12"}}}
+
  
===DeviceRemoveAll===
+
Whenever all the devices are removed, the follow update is received.  
When all the devices are removed the following update will be received.
+
{"commandtype":"DeviceRemoveAll"}
+
  
===DeviceUpdated===
+
 
 +
 +
  "CommandType":"DynamicAllDevicesRemoved"
 +
}
 +
 
 +
===DynamicDeviceUpdated===
 
If any device type or index are changed the following update will be received.
 
If any device type or index are changed the following update will be received.
{"commandtype":"DeviceUpdated","data":{"<device id>":{"devicename":"<device name>","friendlydevicetype":"<friendly device type name >","devicetype":"<device type id >","deviceid":"<device id >","location":"
 
  <location>","devicevalues":{"1":{"index":"<index num>","name":"<index name >","value":"<index val>"},"2":{"index":"<index num>","name":"<index name>","value":"<index val>"},"3":{"index":"<index num>","name":"<index 
 
  name>","value":"<index val>"}}}}}
 
Example
 
{"commandtype":"DeviceUpdated","data":{"27":{"devicename":"ContactSwitch #27","friendlydevicetype":"ContactSwitch","devicetype":"12","deviceid":"27","location":"Default","devicevalues":{"1":
 
{"index":"1","name":"STATE","value":"true"},"2":{"index":"2","name":"LOW BATTERY","value":"0"},"3":{"index":"3","name":"TAMPER","value":"true"}}}}}
 
  
===RuleAdded===
+
 +
  "CommandType":"DynamicDeviceUpdated",
 +
  "Devices":{ 
 +
      "<device id>":{ 
 +
        "Data":{
 +
                "Name":"<device name>",
 +
                "Type":"<device type id >",
 +
                "FriendlyDeviceType":"<friendly device type>",
 +
                "Location":"<location>",
 +
                "LastActiveEpoch":"<time stamp>",
 +
                "Manufacturer":"<manufacturer name>",
 +
                "Version":"<version number>",
 +
                "Model":"<model>",
 +
                "DeviceState":"<0/1/2>"
 +
              },
 +
        "DeviceValues":{ 
 +
            "1":{ 
 +
              "Name":"<index name >",
 +
              "Value":"<index val>",
 +
              "Type":"<index type>"
 +
            },
 +
            "2":{ 
 +
              "Name":"<index name>",
 +
              "Value":"<index val>",
 +
              "Type":"<index type>"
 +
            },
 +
            "3":{ 
 +
              "Name":"<index name>",
 +
              "Value":"<index val>",
 +
              "Type":"<index type>"
 +
            }
 +
        }
 +
        }
 +
  }
 +
}
 +
 
 +
===DynamicRuleAdded===
 +
 
 
When a new rule is added the following update is received.
 
When a new rule is added the following update is received.
{"commandtype":"RuleAdded","ruleid":"<ruleid>"}
 
Example
 
{"commandtype":"RuleAdded","ruleid":"1"}
 
  
===RuleRemoved===
+
{
 +
        "CommandType": "DynamicRuleAdded",
 +
        "Rules": {
 +
                "12": {
 +
                        "Name": "mynewrule",
 +
                        "Valid": "true",
 +
                        "ID":"12",
 +
                        "Triggers": [{
 +
                                "Type": "<type of trigger>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "Grouping": "< AND/OR>",
 +
                                "Condition": "<condition typet>",
 +
                                "Duration": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }],
 +
                        "Results": [{
 +
                                "Type": "<type of result>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "PreDelay": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }, {
 +
                                "Type": "<type of result>",
 +
                                "ID": "<event id>",
 +
                                "EventType": "<event type>",
 +
                                "Value": "<event value>",
 +
                                "PreDelay": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }]
 +
                }
 +
        }
 +
}
 +
 
 +
<br/>
 +
 
 +
===DynamicRuleUpdated===
 +
 
 +
When an existing rule is modified the following update is received.
 +
{
 +
        "CommandType": "DynamicRuleUpdated",
 +
        "Rules": {
 +
                "12": {
 +
                      "ID":"12",
 +
                        "Name": "mynewrule",
 +
                        "Valid": "true",
 +
                        "Triggers": [{
 +
                                "Type": "<type of trigger>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "Grouping": "< AND/OR>",
 +
                                "Condition": "<condition type ie.eq/le/ge/lt/gt>",
 +
                                "Duration": "<time in sec>",
 +
                                "Valid": "true"
 +
                        }],
 +
                        "Results": [{
 +
                                "Type": "<type of result>",
 +
                                "ID": "<device id>",
 +
                                "Index": "<device index>",
 +
                                "Value": "<index value>",
 +
                                "PreDelay": "<time in sec>"
 +
                        }, {
 +
                                "Type": "<type of result>",
 +
                                "ID": "<event id>",
 +
                                "EventType": "<event type>",
 +
                                "Value": "<event value>",
 +
                                "PreDelay": "<time in sec>"
 +
                        }]
 +
                }
 +
        }
 +
}
 +
<br/>
 +
 
 +
===DynamicRuleRemoved===
 +
 
 
When a rule is removed the following update is received.
 
When a rule is removed the following update is received.
  {"commandtype":"RuleRemoved","ruleid":"<ruleid>"}
+
Example
+
  {
{"commandtype":"RuleRemoved","ruleid":"1"}
+
        "CommandType": "DynamicRuleRemoved",
 +
        "Action": "remove",
 +
        "Rules": {
 +
                "1": {}
 +
        }
 +
}
 +
<br/>
  
===RuleUpdated===
+
===DynamicAllRulesRemoved===
When a rule is updated the following update is received.
+
{"commandtype":"RuleUpdated","ruleid":"<ruleid>"}
+
Example
+
{"commandtype":"RuleUpdated","ruleid":"1"}
+
  
===RuleRemoveAll===
+
When all rules are removed the following update is received.  
When all the rules are removed the following update is received.
+
{"commandtype":"RuleRemoveAll"}
+
  
===AlmondModeUpdated===
+
{"CommandType":"DynamicAllRulesRemoved"}
  {"commandtype":"AlmondModeUpdated","data":{"<almond mode >":{"emailid":"<email id>"}}}
+
 
Example
+
<br/>
  {"commandtype":"AlmondModeUpdated","data":{"2":{"emailid":"swetha.reddy@securifi.com"}}}
+
 
 +
===DynamicAlmondModeUpdated===
 +
  {
 +
  "CommandType":"DymanicAlmondModeUpdated",
 +
  "Mode":"<mode i.e.  2/3>",
 +
  "EmailId":"<email id>"
 +
  }
  
 
===DynamicClientAdded===
 
===DynamicClientAdded===
When a new client is added this update is received.
+
When a new client is added the following update is received.
  {
+
 
  "CommandType":"DynamicClientAdded",
+
  {
  "Clients":{
+
        "CommandType": "DynamicClientAdded",
    "ID":"1",
+
        "Clients": {
    "Name":"my phone",
+
                "1": {
    "Connection":"wired",
+
                        "ID":"1",
    "MAC":"c4:43:6d:c9:ef:05",
+
                        "Name": "64:bc:0c:80:62:46",
    "Type":"tv",
+
                        "Connection": "wired",
    "LastKnownIP":"10.10.10.55",
+
                        "MAC": "64:bc:0c:80:62:46",
    "Active":"false",
+
                        "Type": "other",
    "UseAsPresence":"true",
+
                        "LastKnownIP": "10.10.10.97",
    "Wait":"6"
+
                        "Active": "false",
  }
+
                        "UseAsPresence": "true",
 +
                        "Wait": "6",
 +
                        "LastActiveEpoch": "1459845389",
 +
                        "RX": "0",
 +
                        "TX": "0",
 +
                        "Block": "0/1/2",
 +
                        "CanBlock":"true/false",
 +
                        "Category":"Kids/Others",
 +
                        "Schedule": "0,0,0,0,0,0,0",
 +
                        "Manufacturer": "LG",
 +
                        "RSSI": "0",
 +
                        "ForceInActive": "0"
 +
                }
 +
        }
 
  }
 
  }
  
 
===DynamicClientJoined===
 
===DynamicClientJoined===
When a client joined network this update is received.
+
When a client joined network the following update is received.
  {
+
  {
  "CommandType":"DynamicClientJoined",
+
        "CommandType": "DynamicClientJoined",
  "Clients":{
+
        "Clients": {
    "ID":"1",
+
                "1": {
    "Name":"my phone",
+
                        "ID":"1",
    "Connection":"wired",
+
                        "Name": "64:bc:0c:80:62:46",
    "MAC":"c4:43:6d:c9:ef:05",
+
                        "Connection": "wired",
    "Type":"tv",
+
                        "MAC": "64:bc:0c:80:62:46",
    "LastKnownIP":"10.10.10.55",
+
                        "Type": "other",
    "Active":"false",
+
                        "LastKnownIP": "10.10.10.97",
    "UseAsPresence":"true",
+
                        "Active": "true",
    "Wait":"6"
+
                        "UseAsPresence": "true",
  }
+
                        "Wait": "6",
  }  
+
                        "LastActiveEpoch": "1459845389",
 +
                        "RX": "0",
 +
                        "TX": "0",
 +
                        "Block": "0/1/2",
 +
                        "CanBlock":"true/false",
 +
                        "Category":"Kids/Others",
 +
                        "Schedule": "0,0,0,0,0,0,0",
 +
                        "Manufacturer": "LG",
 +
                        "RSSI": "0",
 +
                        "ForceInActive": "0"
 +
                }
 +
        }
 +
  }
  
 +
===DynamicClientLeft===
 +
When a client leaves the network, following update is received.
  
===DynamicClientLeft===
+
  {
When a client leaves the network, following update is received.
+
        "CommandType": "DynamicClientLeft",
  {
+
        "Clients": {
  "CommandType":"DynamicClientLeft",
+
                "1": {
  "Clients":{
+
                        "ID":"1",
    "ID":"1",
+
                        "Name": "64:bc:0c:80:62:46",
    "Name":"my phone",
+
                        "Connection": "wired",
    "Connection":"wired",
+
                        "MAC": "64:bc:0c:80:62:46",
    "MAC":"c4:43:6d:c9:ef:05",
+
                        "Type": "other",
    "Type":"tv",
+
                        "LastKnownIP": "10.10.10.97",
    "LastKnownIP":"10.10.10.55",
+
                        "Active": "false",
    "Active":"false",
+
                        "UseAsPresence": "true",
    "UseAsPresence":"true",
+
                        "Wait": "6",
    "Wait":"6"
+
                        "LastActiveEpoch": "1459845389",
  }
+
                        "RX": "0",
 +
                        "TX": "0",
 +
                        "Block": "0/1/2",
 +
                        "CanBlock":"true/false",
 +
                        "Category":"Kids/Others",
 +
                        "Schedule": "0,0,0,0,0,0,0",
 +
                        "Manufacturer": "LG",
 +
                        "RSSI": "0",
 +
                        "ForceInActive": "0"
 +
                }
 +
        }
 
  }
 
  }
  
 
===DynamicClientUpdated===
 
===DynamicClientUpdated===
When a name change or any changes done to a client this update is received.
+
When a name change or any changes done to a client the following update is received.
  
  {
+
  {
  "CommandType":"DynamicClientUpdated",
+
        "CommandType": "DynamicClientUpdated",
  "Clients":{
+
        "Clients": {
    "ID":"1",
+
                "1": {
    "Name":"my phone",
+
                        "ID":"1",
    "Connection":"wired",
+
                        "Name": "64:bc:0c:80:62:46",
    "MAC":"c4:43:6d:c9:ef:05",
+
                        "Connection": "wired",
    "Type":"tv",
+
                        "MAC": "64:bc:0c:80:62:46",
    "LastKnownIP":"10.10.10.55",
+
                        "Type": "other",
    "Active":"false",
+
                        "LastKnownIP": "10.10.10.97",
    "UseAsPresence":"true",
+
                        "Active": "false",
    "Wait":"6"
+
                        "UseAsPresence": "true",
  }
+
                        "Wait": "6",
 +
                        "LastActiveEpoch": "1459845389",
 +
                        "RX": "0",
 +
                        "TX": "0",
 +
                        "Block": "0/1/2",
 +
                        "CanBlock":"true/false",
 +
                        "Category":"Kids/Others",
 +
                        "Schedule": "0,0,0,0,0,0,0",
 +
                        "Manufacturer": "LG",
 +
                        "RSSI": "0",
 +
                        "ForceInActive": "0"
 +
                }
 +
        }
 
  }
 
  }
  
 
===DynamicClientRemoved===
 
===DynamicClientRemoved===
When a client is removed this update is received
+
When a client is removed this update is received
  {"CommandType":"DynamicClientRemoved","ID":"1","MAC":"c4:43:6d:c9:ef:05"}
+
 
 +
  {
 +
        "CommandType": "DynamicClientRemoved",
 +
        "Action": "remove",
 +
        "Clients": {
 +
                "1":{
 +
                        "MAC": "1c:75:08:32:2a:6d"
 +
                      }
 +
        }
 +
}
  
 
===DynamicAllClientsRemoved===
 
===DynamicAllClientsRemoved===
When all the clients are removed this update is received
+
When all the clients are removed this update is received
  {"CommandType":"DynamicAllClientsRemoved"}
+
 +
  {
 +
"CommandType":"DynamicAllClientsRemoved"
 +
}
  
 
===DynamicSceneAdded===
 
===DynamicSceneAdded===
  when a new scene is added this update is received.
+
  When a new scene is added the following update is received.
  {
+
  {
  "CommandType":"DynamicSceneAdded",
+
        "CommandType": "DynamicSceneAdded",
  "Scenes":{
+
        "Scenes": {
    "ID":"1",
+
                "1": {
    "Name":"My_created_scene",
+
                        "ID":"1",
    "LastActiveEpoch":"8295685751190847488",
+
                        "Active": "true",
    "Active":"false",
+
                        "Name": "Scene1022",
    "SceneEntryList":[
+
                        "LastActiveEpoch": "251176214925585",
    {"DeviceID":"1","Index":"1","Value":"false","Valid":"true"},
+
                        "VoiceCompatible":"true",
    {"DeviceID":"1","Index":"2","Value":"false","Valid":"false"}
+
                        "SceneEntryList": [{
    ]
+
                                "ID": "1",
  }
+
                                "Index": "1",
 +
                                "Value": "false",
 +
                                "Valid": "true"
 +
                        }, {
 +
                                "ID": "4",
 +
                                "Index": "1",
 +
                                "Value": "78",
 +
                                "Valid": "false"
 +
                        }]
 +
        }
 +
        }
 
  }
 
  }
  
 
===DynamicSceneUpdated===
 
===DynamicSceneUpdated===
when any changes are made to existing scene this update is received.
+
when any changes are made to an existing scene the following update is received.
  {
+
  {
  "CommandType":"DynamicSceneUpdated",
+
        "CommandType": "DynamicSceneUpdated",
  "Scenes":{
+
        "Scenes": {
    "ID":"1",
+
                "1": {
    "Name":"My_created_scene",
+
                      "ID":"1",
    "LastActiveEpoch":"8295685751190847488",
+
                        "Active": "true",
    "Active":"false",
+
                        "Name": "Scene1022",
    "SceneEntryList":[
+
                        "LastActiveEpoch": "251176214925585",
      {"DeviceID":"2","Index":"1","Value":"false","Valid":"true"},
+
                        "VoiceCompatible":"true",
      {"DeviceID":"4","Index":"1","Value":"78","Valid":"false"}
+
                        "SceneEntryList": [{
    ]
+
                                "ID": "1",
  }
+
                                "Index": "1",
 +
                                "Value": "false",
 +
                                "Valid": "true"
 +
                        }, {
 +
                                "ID": "4",
 +
                                "Index": "1",
 +
                                "Value": "78",
 +
                                "Valid": "true"
 +
                        }]
 +
                }
 +
        }
 
  }
 
  }
  
 
===DynamicSceneActivated===
 
===DynamicSceneActivated===
when any scene is activated this update is received.
+
When any scene is activated the following update is received.
  {  
+
   
  "CommandType":"DynamicSceneActivated",
+
  {
  "Scenes":
+
        "CommandType": "DynamicSceneActivated",
    "ID":"1",
+
        "Action": "update",
    "LastActiveEpoch":"8295685751190847488",
+
        "Scenes": {
    "Active":"true",
+
                "1": {
} }
+
                        "Active": "true",
 +
                        "LastActiveEpoch": "251176214925585"
 +
                }
 +
        }
 +
}
  
 
===DynamicSceneRemoved===
 
===DynamicSceneRemoved===
when any scene is removed this update is received.
+
When any scene is removed the following update is received.
  {
+
  {
  "CommandType":"DynamicSceneRemoved",
+
        "CommandType": "DynamicSceneRemoved",
  "Scenes":
+
        "Action": "remove",
    "ID":"1"
+
        "Scenes": {
  }
+
                "1": {}
 +
        }
 
  }
 
  }
  
 
===DynamicAllScenesRemoved===
 
===DynamicAllScenesRemoved===
when all scenes are removed this update is received.
+
When all scenes are removed the following update is received.
  {"CommandType":"DynamicAllScenesRemoved"}
+
 
 +
  {
 +
        "CommandType": "DynamicAllScenesRemoved"
 +
}

Latest revision as of 14:52, 1 April 2019

Websocket is the protocol for establishing an interaction channel between an external application and Almond. It is also possible to receive event-based notifications. Websocket can be used to control smart devices that are paired with Almond and build smart applications around it.

Authentication

In order to connect to the webserver - first specify a web-interface url, then the portid - 7681 followed by web-interface login password.

<webinterfaceUrl>:<portid>/<Login>/<password>

Example ws://10.10.10.254:7681/root/frank

Device Commands

Note: mii is a random key that is generated by the client and should be used for matching the received response to the corresponding request.
Maximum string length of mii is 32 characters. A unique mii should be used for each request

Devicelist

Command to get the list of sensors and other smart devices associated with the almond.

Request
{  
 "MobileInternalIndex":"<random key>",
 "CommandType":"DeviceList"
}
Response
{  
  "MobileInternalIndex":"<random key>",
  "CommandType":"DeviceList",
  "Devices":{  
     "1":{  
       "Data":{ 
               "ID":"1",
               "Name":"ContactSwitch #1",
               "Type":"12",
               "FriendlyDeviceType":"ContactSwitch",
               "Location":"Default",
               "LastActiveEpoch":"1462172879", 
               "Manufacturer":"Sercomm Corp.",
               "Version":"16",
               "Model":"Unknown",
               "DeviceState":"1"
       },
        "DeviceValues":{  
           "1":{  
              "Name":"STATE",
              "Value":"true",
              "Type":"4"
           },
           "2":{  
              "Name":"LOW BATTERY",
              "Value":"0",
              "Type":"12"
           },
           "3":{  
              "Name":"TAMPER",
              "Value":"true",
              "Type":"9"
           }
        }
     },
     "2":{ 
       "Data":{  
                "ID":"2",
                "Name":"BinarySwitch #2",
                "Type":"1",
                "FriendlyDeviceType":"BinarySwitch",
                "Location":"Default",
                "LastActiveEpoch":"1462175634", 
                "Manufacturer":"Sercomm Corp.",
                "Version":"16",
                "Model":"SZ-BSW01",
                "DeviceState":"1"
        },
        "DeviceValues":{  
           "1":{  
              "Name":"SWITCH BINARY",
              "Value":"true",
              "Type":"1"
           }
        }
     }
  }
}

Updatedeviceindex

Request
{
"MobileInternalIndex":"<random key>",
"CommandType":"UpdateDeviceIndex",
"ID":"<device id>",
"Index":"<deviceindex>",
"Value":"<indexvalue>"
}
Response
{ "MobileInternalIndex":"<random key>", "CommandType":"UpdateDeviceIndex", "Success":"true/false" }

Getdeviceindex

Command to get the value of a device index.

Request
{  
"MobileInternalIndex":"<random key>",
 "CommandType":"GetDeviceIndex",
 "ID":"<deviceid>",
 "Index":"<deviceindex>"
}
Response
{ "MobileInternalIndex":"<random key>", "CommandType":"GetDeviceIndex", "Success":"true/false", "Value":"<indexvalue>" }

UpdateDeviceName

Command to edit name and location of a device.
Request

{ 
 "MobileInternalIndex":"<random key>",
 "CommandType":"UpdateDeviceName",
 "ID":"6",
 "Name":"newswitchsss",
 "Location":"default"
}
Response
{ "MobileInternalIndex":"<random key>", "CommandType":"UpdateDeviceName", "Success":"true/false" }

Updatealmondmode

Command to change the almond mode.
Request
{ "MobileInternalIndex":"<random key>", "CommandType":"UpdateAlmondMode", "Mode":"<mode i.e. 2/3>", "EmailId":"<email id>" } Response
{ "MobileInternalIndex":"<random key>", "CommandType":"UpdateAlmondMode", "Success":"true/false" }


Rules Commands

Note: mii is a random key that is generated by the client and should be used for matching the received response to the corresponding request. Maximum string length of mii is 32 characters. A unique mii should be used for each request.

Ruleslist

Command to get the list of existing rules.

Request:

{
 "CommandType":"RuleList",
  "MobileInternalIndex":"111"
}


Response:

{
       "CommandType": "RuleList",
       "Rules": {
               "12": {
                       "Name": "mynewrule",
                       "Valid": "true",
                       "ID":"12",
                       "Triggers": [{
                               "Type": "<type of trigger>",
                               "ID": "<device id>",
                               "Index": "<device index>",
                               "Value": "<index value>",
                               "Grouping": "< AND/OR>",
                               "Condition": "<condition type ie.eq/le/ge/lt/gt>",
                               "Duration": "


Addrule

Command to create a new rule.
Request

{
   "MobileInternalIndex": "111",
   "CommandType": "AddRule",
   "Name": "rule",      
    "Valid":"true",
   "Triggers": [
       {
           "Type": "<type of trigger>",
           "ID": "<device id>",
           "Index": "<device index>",
           "Value": "<index value>",
           "Grouping": "< AND/OR>",
           "Condition": "<condition type ie.eq/le/ge/lt/gt>",
           "Duration": "<time in sec>",
           "Valid": "true"
       },
       {
           "Type": "<type of trigger>",
           "ID": "<event id>",
           "EventType": "<event type>",
           "value": "<event value>",
           "Grouping": "<AND/OR>",
           "Condition": "<condition type ie.eq/le/ge/lt/gt>",
           "Duration": "<time in sec>",
           "Valid": "true"
       }
   ],
   "Results": [
       {
           "Type": "<type of result>",
           "ID": "<device id>",
           "Index": "<device index>",
           "Value": "<index value>",
           "PreDelay": "<time in sec>",
           "Valid": "true"
       },
       {
           "Type": "<type of result>",
           "ID": "<event id>",
           "EventType": "<event type>",
           "Value": "<event value>",
           "PreDelay": "<time in sec>",
           "Valid": "true"
  }
 ]
}

Response

{  
   "CommandType":"AddRule",
   "Success":"true",
   "MobileInternalIndex":"111",
   "ReasonCode":"1"
}


Updaterule

Command to update an existing rule.
Request

{
   "MobileInternalIndex": "111",
   "CommandType": "UpdateRule",
   "Name": "ruleNAME",       
   "Valid":"true",
   "ID": "2",
   "Triggers": [
       {
           "Type": "<type of trigger>",
           "ID": "<device id>",
           "Index": "<device index>",
           "Value": "<index value>",
           "Grouping": "< AND/OR>",
           "Condition": "<condition type ie.eq/le/ge/lt/gt>",
           "Duration": "<time in sec>",
            "Valid":"true"
       },
       {
           "Type": "<type of trigger>",
           "ID": "<event id>",
           "EventType": "<event type>",
           "Value": "<event value>",
           "Grouping": "<AND/OR>",
           "Condition": "<condition type ie.eq/le/ge/lt/gt>",
           "Duration": "<time in sec>",
            "Valid":"true"
       }
   ],
   "Results": [
       {
           "Type": "<type of result>",
           "ID": "<device id>",
           "Index": "<device index>",
           "Value": "<index value>",
           "PreDelay": "<time in sec>"
       },
       {
           "Type": "<type of result>",
           "ID": "<event id>",
           "EventType": "<event type>",
           "Value": "<event value>",
           "PreDelay": "<time in sec>"
       }
   ]
}


Response

{  
   "CommandType":"UpdateRule",
   "Success":"true",
   "MobileInternalIndex":"111",
   "ReasonCode":"1"
}


Removerule

Command to remove an existing rule.
Request

{
 "CommandType": "RemoveRule",
 "Rules": {
 "ID": "1"
},
 "MobileInternalIndex": "111"
}


Response

{
 "CommandType":"RemoveRule",
 "Success":"true",
 "MobileInternalIndex":"111",
 "ReasonCode":"0"
}



Removeallrules

Command to remove all rules.
Request

{
 "CommandType":"RemoveAllRules",
 "MobileInternalIndex":"111"
}


Response

{
 "CommandType":"RemoveAllRules",
 "Success":"true",
 "MobileInternalIndex":"111",
 "ReasonCode":"0"

}


Validaterule

Command to validate an existing rule.
Request

{
 "CommandType":"ValidateRule",
 "ID":"1",
 "Value":"true"
 "MobileInternalIndex":"111"
}


Response

{
 "CommandType":"ValidateRule",
 "MobileInternalIndex":"111",
 "ReasonCode":"0",
 "Success":"false",
 "Data":{
 "Value":"true",
 "ID":"1"
}
}



ClientList

Command to get clientlist.
Request

{  
 "MobileInternalIndex":"<random key>",
 "CommandType":"ClientList"
}

Response

{
       "CommandType": "ClientList",
       "MobileInternalIndex":"<random key same as request>",
       "Success":"true",
       "Clients": {
              "1": {
                       "ID":"1",
                       "Name": "64:bc:0c:80:62:46",
                       "Connection": "wired",
                       "MAC": "64:bc:0c:80:62:46",
                       "Type": "other",
                       "LastKnownIP": "10.10.10.97",
                       "Active": "false",
                       "UseAsPresence": "true",
                       "Wait": "6",
                       "LastActiveEpoch": "1459845389",
                       "RX": "0",
                       "TX": "0",
                       "Block": "0/1/2",
                       "CanBlock":"true/false",
                       "Category":"Kids/Others",
                       "Schedule": "0,0,0,0,0,0,0",
                       "Manufacturer": "LG",
                       "RSSI": "0",
                       "ForceInActive": "0"
               },
               "2": {
                       "ID":"2",
                       "Name": "64:bc:0c:80:62:46",
                       "Connection": "wired",
                       "MAC": "64:bc:0c:80:62:46",
                       "Type": "other",
                       "LastKnownIP": "10.10.10.97",
                       "Active": "false",
                       "UseAsPresence": "true",
                       "Wait": "6",
                       "LastActiveEpoch": "1459845389",
                       "RX": "0",
                       "TX": "0",
                       "Block": "0",
                       "Schedule": "0,0,0,0,0,0,0",
                       "Manufacturer": "LG",
                       "RSSI": "0",
                       "ForceInActive": "0"
               }
       }
}

Note - Success Tag in response:
If the Almond is in AP mode or Range Extender mode then Success tag will be set to ‘false’.

UpdateClient

Command to Update the data of a client.
ID - Clientid
Name - name of the client
Connection - wired/wireless

Type - pc
       laptop
       tablet  
       smartphone
       ipod
       ipad
       iphone
       mac
       printer
       router_switch
       hub
       tv
       chromecast
       appleTV
       android_stick
       camera
       nest
       other
Use as Presence - true/false
Request
{ "CommandType":"UpdateClient", "Clients":{ "ID": "1", "Name": "device1", "Connection": "wired", "MAC": "1c:75:08:32:2a:6d", "Type": "other", "LastKnownIP": "10.2.2.11", "Active": "false", "UseAsPresence": "false", "Wait":"6", "Block":"0/1/2", "Category":"Kids/Others" }, "MobileInternalIndex":"324" } Response
{ "Success":"true/false", "MobileInternalIndex":"324", "ReasonCode":"0" }

Remove client

command to remove a client.
Request

{  
 "MobileInternalIndex":"<random key>",
 "CommandType":"RemoveClient",
 "Clients":{  
   "ID":"1",
   "MAC":"1c:75:08:32:2a:6d"
 }
}

Response
Success

{
 "CommandType":"RemoveClient", 
 "MobileInternalIndex":"324",
 "Success":"true",
 "Reason":"0" 
}

Failure

{
 "CommandType":"RemoveClient",
 "MobileInternalIndex":"324",
 "Success":"false",
 "Reason":"0"
}

Removeallclients

Command to remove all clients
Request

{  
 "MobileInternalIndex":"<random key>",
 "CommandType":"RemoveAllClients",
}

Response
Success

{
 "CommandType":"RemoveAllClients",
 "MobileInternalIndex":"324",
 "Success":"true",
 "ReasonCode":"0"
}

Failure

{
 "CommandType":"RemoveAllClients",
 "MobileInternalIndex":"324",
 "Success":"false",
 "ReasonCode":"0"
}


ScenesCommands

Note:mii(MobileInternalIndex) is a random key that is generated by the client and should be used for matching the received response to the corresponding request. Maximum string length of mii is 32 characters. A unique mii should be used for each request

SceneList

Command to retrieve the list of existing Scenes.
Request

{
 "CommandType":"DynamicSceneList",
 "MobileInternalIndex":"5432857"
}

Response
Note: Active :- Indicates the state of Scene

{
       "CommandType": "DynamicSceneList",
       "MobileInternalIndex":"<same as in request>",
       "Scenes": {
               "1": {
                       "ID":"1",
                       "Active": "true",
                       "Name": "Scene1022",
                       "LastActiveEpoch": "251176214925585",
                       "VoiceCompatible":"true",
                       "SceneEntryList": [{
                               "ID": "2",
                               "Index": "1",
                               "Value": "false",
                               "Valid": "true"
                       }, {
                               "ID": "4",
                               "Index": "1",
                               "Value": "78",
                               "Valid": "true"
                       }]
               }
       }
}

AddScene

Command to add a new Scene.
Request

{
"CommandType": "AddScene",
"MobileInternalIndex": "324",
"Scenes":{
"Name": "My_created_scene",
"SceneEntryList": [
{
"ID": "1",
"Index": "1",
"Value": "false"
},
{
"ID": "2",
"Index": "2",
"Value": "false"
}
]}
}

Response

{
"CommandType":"AddScene",
"MobileInternalIndex":"324",
"ReasonCode":"0",
"Success":"true"
}

UpdateScene

Command to update an existing Scene
Request

{
"MobileInternalIndex": 1667509461,
"Scenes": {
"Name": "DADad222d",
"ID": 1,
"SceneEntryList": [{
"ID": 0,
"Value": "home",
"Index": 1
}, {
"ID": 2,
"Value": "false",
"Index": 1
}, {
"ID": 2,
"Value": "true",
"Index": 2
}],
"VoiceCompatible": false
},"CommandType": "UpdateScene"
}

Response

{"MobileInternalIndex":"324",
"ReasonCode":"0",
"Success":"true"
}

ActivateScene

Command to activate a Scene
Request

{  
 "CommandType":"ActivateScene",
 "MobileInternalIndex":"324",
 "Scenes":{  
   "ID":"11"
 }
}

Response

{"CommandType":"ActivateScene","MobileInternalIndex":"324","Success":"true","Reason":"0"}


RemoveScene

Command to remove a Scene
Request

{  
 "CommandType":"RemoveScene",
 "MobileInternalIndex":"324",
 "Scenes":{  
   "ID":"11"
 }
}

Response

{"CommandType":"RemoveScene","MobileInternalIndex":"324","Success":"true","Reason":"0"} 

RemoveAllScenes

Command to remove all Scenes
Request

{  
 "CommandType":"RemoveAllScenes",
 "MobileInternalIndex":"324"
}

Response

{"CommandType":"RemoveAllScenes","MobileInternalIndex":"324","Success":"true","Reason":"0"}

Notification and Event Updates

DynamicIndexUpdated

If any device index is changed, the following update will be received.

{  
  "CommandType":"DynamicIndexUpdated",
  "Devices":{  
     "<device id>":{ 
       "DeviceValues":{ 
                "<index id>":{  
                   "Name":"<index name>",
                   "Value":"<index value>"
                }
       }
     }
  }
}

DynamicDeviceAdded

Whenever a device is added, the follow update would be received. 

{  
  "CommandType":"DynamicDeviceAdded",
  "Devices":{  
     "<device id>":{ 
        "Data":{
                 "Name":"<device name>",
                 "Type":"<device type id >",
                 "FriendlyDeviceType":"<friendly device type>",
                 "Location":"<location>",
                 "LastActiveEpoch":"<time stamp>", 
                 "Manufacturer":"<manufacturer name>",
                 "Version":"<version number>",
                 "Model":"<model>",
                 "DeviceState":"<0/1/2>"
               },
        "DeviceValues":{  
           "1":{  
              "Name":"<index name >",
              "Value":"<index val>",
              "Type":"<index type>"
           },
           "2":{  
              "Name":"<index name>",
              "Value":"<index val>",
              "Type":"<index type>"
           },
           "3":{  
              "Name":"<index name>",
              "Value":"<index val>",
              "Type":"<index type>"
           }
        }
     }
  }
}

DynamicDeviceRemoved

Whenever a device is removed, the following update is received. 

{  
  "CommandType":"DynamicDeviceRemoved",
  "Action":"remove",
 "Devices":{ 
  "25":{
   "Type":"<device type id >"}
  }
}

DynamicAllDevicesRemoved

Whenever all the devices are removed, the follow update is received. 


{  
  "CommandType":"DynamicAllDevicesRemoved"
}

DynamicDeviceUpdated

If any device type or index are changed the following update will be received.

{  
  "CommandType":"DynamicDeviceUpdated",
  "Devices":{  
     "<device id>":{  
       "Data":{
               "Name":"<device name>",
               "Type":"<device type id >",
               "FriendlyDeviceType":"<friendly device type>",
               "Location":"<location>",
               "LastActiveEpoch":"<time stamp>", 
               "Manufacturer":"<manufacturer name>",
               "Version":"<version number>",
               "Model":"<model>",
               "DeviceState":"<0/1/2>"
              },
        "DeviceValues":{  
           "1":{  
              "Name":"<index name >",
              "Value":"<index val>",
              "Type":"<index type>"
           },
           "2":{  
              "Name":"<index name>",
              "Value":"<index val>",
              "Type":"<index type>"
           },
           "3":{  
              "Name":"<index name>",
              "Value":"<index val>",
              "Type":"<index type>"
           }
        }
       }
  }
}

DynamicRuleAdded

When a new rule is added the following update is received.

{
       "CommandType": "DynamicRuleAdded",
       "Rules": {
               "12": {
                       "Name": "mynewrule",
                       "Valid": "true",
                       "ID":"12",
                       "Triggers": [{
                               "Type": "<type of trigger>",
                               "ID": "<device id>",
                               "Index": "<device index>",
                               "Value": "<index value>",
                               "Grouping": "< AND/OR>",
                               "Condition": "<condition typet>",
                               "Duration": "<time in sec>",
                               "Valid": "true"
                       }],
                       "Results": [{
                               "Type": "<type of result>",
                               "ID": "<device id>",
                               "Index": "<device index>",
                               "Value": "<index value>",
                               "PreDelay": "<time in sec>",
                               "Valid": "true"
                       }, {
                               "Type": "<type of result>",
                               "ID": "<event id>",
                               "EventType": "<event type>",
                               "Value": "<event value>",
                               "PreDelay": "<time in sec>",
                               "Valid": "true"
                       }]
               }
       }
}


DynamicRuleUpdated

When an existing rule is modified the following update is received.

{
       "CommandType": "DynamicRuleUpdated",
       "Rules": {
               "12": {
                      "ID":"12",
                       "Name": "mynewrule",
                       "Valid": "true",
                       "Triggers": [{
                               "Type": "<type of trigger>",
                               "ID": "<device id>",
                               "Index": "<device index>",
                               "Value": "<index value>",
                               "Grouping": "< AND/OR>",
                               "Condition": "<condition type ie.eq/le/ge/lt/gt>",
                               "Duration": "<time in sec>",
                               "Valid": "true"
                       }],
                       "Results": [{
                               "Type": "<type of result>",
                               "ID": "<device id>",
                               "Index": "<device index>",
                               "Value": "<index value>",
                               "PreDelay": "<time in sec>"
                       }, {
                               "Type": "<type of result>",
                               "ID": "<event id>",
                               "EventType": "<event type>",
                               "Value": "<event value>",
                               "PreDelay": "<time in sec>"
                       }]
               }
       }
}


DynamicRuleRemoved

When a rule is removed the following update is received.

{
       "CommandType": "DynamicRuleRemoved",
       "Action": "remove",
       "Rules": {
               "1": {}
       }
}


DynamicAllRulesRemoved

When all rules are removed the following update is received.

{"CommandType":"DynamicAllRulesRemoved"}


DynamicAlmondModeUpdated

{
  "CommandType":"DymanicAlmondModeUpdated",
  "Mode":"<mode i.e.  2/3>",
  "EmailId":"<email id>"
}

DynamicClientAdded

When a new client is added the following update is received.

{
       "CommandType": "DynamicClientAdded",
       "Clients": {
               "1": {
                       "ID":"1",
                       "Name": "64:bc:0c:80:62:46",
                       "Connection": "wired",
                       "MAC": "64:bc:0c:80:62:46",
                       "Type": "other",
                       "LastKnownIP": "10.10.10.97",
                       "Active": "false",
                       "UseAsPresence": "true",
                       "Wait": "6",
                       "LastActiveEpoch": "1459845389",
                       "RX": "0",
                       "TX": "0",
                       "Block": "0/1/2",
                       "CanBlock":"true/false",
                       "Category":"Kids/Others",
                       "Schedule": "0,0,0,0,0,0,0",
                       "Manufacturer": "LG",
                       "RSSI": "0",
                       "ForceInActive": "0"
               }
       }
}

DynamicClientJoined

When a client joined network the following update is received.
{
       "CommandType": "DynamicClientJoined",
       "Clients": {
               "1": {
                       "ID":"1",
                       "Name": "64:bc:0c:80:62:46",
                       "Connection": "wired",
                       "MAC": "64:bc:0c:80:62:46",
                       "Type": "other",
                       "LastKnownIP": "10.10.10.97",
                       "Active": "true",
                       "UseAsPresence": "true",
                       "Wait": "6",
                       "LastActiveEpoch": "1459845389",
                       "RX": "0",
                       "TX": "0",
                       "Block": "0/1/2",
                       "CanBlock":"true/false",
                       "Category":"Kids/Others",
                       "Schedule": "0,0,0,0,0,0,0",
                       "Manufacturer": "LG",
                       "RSSI": "0",
                       "ForceInActive": "0"
               }
       }
}

DynamicClientLeft

When a client leaves the network, following update is received.
{
       "CommandType": "DynamicClientLeft",
       "Clients": {
               "1": {
                       "ID":"1",
                       "Name": "64:bc:0c:80:62:46",
                       "Connection": "wired",
                       "MAC": "64:bc:0c:80:62:46",
                       "Type": "other",
                       "LastKnownIP": "10.10.10.97",
                       "Active": "false",
                       "UseAsPresence": "true",
                       "Wait": "6",
                       "LastActiveEpoch": "1459845389",
                       "RX": "0",
                       "TX": "0",
                       "Block": "0/1/2",
                       "CanBlock":"true/false",
                       "Category":"Kids/Others",
                       "Schedule": "0,0,0,0,0,0,0",
                       "Manufacturer": "LG",
                       "RSSI": "0",
                       "ForceInActive": "0"
               }
       }
}

DynamicClientUpdated

When a name change or any changes done to a client the following update is received.

{
       "CommandType": "DynamicClientUpdated",
       "Clients": {
               "1": {
                       "ID":"1",
                       "Name": "64:bc:0c:80:62:46",
                       "Connection": "wired",
                       "MAC": "64:bc:0c:80:62:46",
                       "Type": "other",
                       "LastKnownIP": "10.10.10.97",
                       "Active": "false",
                       "UseAsPresence": "true",
                       "Wait": "6",
                       "LastActiveEpoch": "1459845389",
                       "RX": "0",
                       "TX": "0",
                       "Block": "0/1/2",
                       "CanBlock":"true/false",
                       "Category":"Kids/Others",
                       "Schedule": "0,0,0,0,0,0,0",
                       "Manufacturer": "LG",
                       "RSSI": "0",
                       "ForceInActive": "0"
               }
       }
}

DynamicClientRemoved

When a client is removed this update is received
{
       "CommandType": "DynamicClientRemoved",
       "Action": "remove",
       "Clients": {
               "1":{
                       "MAC": "1c:75:08:32:2a:6d"
                      }
       }
}

DynamicAllClientsRemoved

When all the clients are removed this update is received

{
"CommandType":"DynamicAllClientsRemoved"
}

DynamicSceneAdded

When a new scene is added the following update is received.
{
       "CommandType": "DynamicSceneAdded",
       "Scenes": {
               "1": {
                       "ID":"1",
                       "Active": "true",
                       "Name": "Scene1022",
                       "LastActiveEpoch": "251176214925585",
                       "VoiceCompatible":"true",
                       "SceneEntryList": [{
                               "ID": "1",
                               "Index": "1",
                               "Value": "false",
                               "Valid": "true"
                       }, {
                               "ID": "4",
                               "Index": "1",
                               "Value": "78",
                               "Valid": "false"
                       }]
        }
       }
}

DynamicSceneUpdated

when any changes are made to an existing scene the following update is received.

{
       "CommandType": "DynamicSceneUpdated",
       "Scenes": {
               "1": {
                      "ID":"1",
                       "Active": "true",
                       "Name": "Scene1022",
                       "LastActiveEpoch": "251176214925585",
                       "VoiceCompatible":"true",
                       "SceneEntryList": [{
                               "ID": "1",
                               "Index": "1",
                               "Value": "false",
                               "Valid": "true"
                       }, {
                               "ID": "4",
                               "Index": "1",
                               "Value": "78",
                               "Valid": "true"
                       }]
               }
       }
}

DynamicSceneActivated

When any scene is activated the following update is received.

{
       "CommandType": "DynamicSceneActivated",
       "Action": "update",
       "Scenes": {
               "1": {
                       "Active": "true",
                       "LastActiveEpoch": "251176214925585"
               }
       }

}

DynamicSceneRemoved

When any scene is removed the following update is received.
{
       "CommandType": "DynamicSceneRemoved",
       "Action": "remove",
       "Scenes": {
               "1": {}
       }
}

DynamicAllScenesRemoved

When all scenes are removed the following update is received.
{
       "CommandType": "DynamicAllScenesRemoved"
}