Difference between revisions of "Changelog"

From SecuriWiki
Jump to: navigation, search
m (Updated Commands - R085)
 
Line 1: Line 1:
 +
== 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 />
  
==Rules Commands==
+
<webinterfaceUrl>:<portid>/<Login>/<password><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===
+
Example ws://10.10.10.254:7681/root/frank<br />
Command to get the list of existing rules.
+
 
Request:<br />
+
== 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.<br />
 +
Maximum string length of mii is 32 characters. A unique mii should be used for each request<br />
 +
 
 +
=== Devicelist ===
 +
 
 +
Command to get the list of sensors and other smart devices associated with the almond. <br />
 +
 
 +
Request
 
  {   
 
  {   
  "mii":"<random key>",
+
  "mii":"<random key>",
  "cmd":"ruleslist"
+
  "cmd":"devicelist"
 
  }
 
  }
<br />
+
 
Response:<br />
+
Response
  { "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":
+
  "mii":"<random key>","commandtype":"devicelist","data" : {"1":{"devicename":"ContactSwitch #1","friendlydevicetype":"ContactSwitch","devicetype":"12","deviceid":"1","location":"Default","devicevalues":
  {"resultid":"1","resulttype":"DeviceResult","deviceid":"6","deviceindex":"1","predelay":"2","validation":"true","value":"false"}}},"3":{"ruleid":"3","name":"r2","valid":"1","triggers":{"1":
+
  {"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
  {"triggerid":"1","triggertype":"TimeTrigger","range":"0","hour":"5","minutes":"3","dayofmonth":"*","dayofweek":"1,2,3,4,5","monthofyear":"*","groupingyear":"AND","validaion":"true"},"2":
+
  #2","friendlydevicetype":"BinarySwitch","devicetype":"1","deviceid":"2","location":"Default","devicevalues":{"1":{"index":"1","name":"SWITCH BINARY","value":"true"}}}}
  {"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"}}}}
+
=== Setdeviceindex ===
  }<br />
+
Command to set the device index value without timeout. <br />
===Createrule===
+
 
Command to create a new rule.<br />
+
Request
Request<br />
+
 
  {   
 
  {   
 
   "mii":"<random key>",
 
   "mii":"<random key>",
   "cmd":"createrule",
+
   "cmd":"setdeviceindex",
   "rulename":"<name of rule>"
+
   "devid":"<device id>",
}<br />
+
  "index":"<deviceindex>",
 +
  "value":"<indexvalue>"
 +
}
 +
 
 
Response<br />
 
Response<br />
 
Success<br />
 
Success<br />
 
  {  
 
  {  
   "mii":"<random key>","commandtype":"createrule","success":"true","data":{"ruleid":"<ruleid>","rulename":"<name of rule>"}
+
   "mii":"<random key>","commandtype":"setdeviceindex","success":"true","data":{"devid":"<deviceid>","index":"<deviceindex>","value":"<indexvalue>"}
  }
+
  }<br />
<br />
+
 
Failure<br />
 
Failure<br />
 
  {
 
  {
   "mii":"<random key>","commandtype":"createrule","success":"false"
+
   "mii":"<random key>","commandtype":"setdeviceindex",:"success":"false"}
 
  }
 
  }
 
<br />
 
<br />
 
Example<br />
 
Example<br />
In the following example, a new rule with rule name ‘myrule’ is created.<br />
+
In the following example, the value of index 1 is set to ‘true’ for device id 2.<br />
+
  "mii":"kjvfjk",
+
  "cmd":"createrule",
+
  "rulename":"myrule"
+
}
+
Response
+
 
  {
 
  {
   "mii":"kjvfjk","commandtype":"createrule","success":"true","data":{"ruleid":"4","rulename":"myrule"}
+
   "mii":"jdnbc",
 +
  "cmd":"setdeviceindex",
 +
  "devid":"2",
 +
  "index":"1",
 +
  "value":"true",
 
  }
 
  }
<br />
+
Response <br />
===Removerule===
+
Command to remove an existing rule.<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>"}
+
   "mii":"jdnbc","commandtype":"setdeviceindex","success":"true","data":{"devid":"2","index":"1","value":"true"}
}
+
  }<br />
<br />
+
 
Failure<br />
+
===Getdeviceindex===
1 - {  "mii":"<random key>","commandtype":"removerule.","success":"false","data":{"ruleid":"<ruleid>"}}
+
Command to get the value of a device index.
2 - {  "mii":"<random key>","commandtype":"removerule.","success":"false"}
+
<br />
+
Example<br />
+
In the following example, the rule with ruleid=1 is removed.<br />
+
+
  "mii":"dhbdc",
+
  "cmd":"removerule",
+
  "ruleid":"1"
+
}
+
<br />
+
Response<br />
+
{
+
  "mii":"dhbdc","commandtype":"removerule.","success":"true","data":{"ruleid":"1","rulename":"myrule"}
+
  }
+
===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 />
+
{
+
  "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
 
Request
 
  {   
 
  {   
  "mii":"<random key>",  
+
  "mii":"<random key>",
  "cmd":"addtrigger",
+
  "cmd":"getdeviceindex",
  "ruleid":"<ruleid>",
+
  "devid":"<deviceid>",
  "triggertype":"<type of trigger>",
+
  "index":"<deviceindex>"
  "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 />
 
Response<br />
 
Success
 
Success
 
  {
 
  {
   "mii":"<random key>", "commandtype":"addtrigger.","success":"true","data":{"ruleid":"<ruleid>"}
+
   "mii":"<random key>","commandtype":"getdeviceindex","success":"true","data":{"devid":"<deviceid>","index":"<deviceindex>","value":"<indexvalue>"}
 
  }
 
  }
 
Failure
 
Failure
  1 - {"mii":"<random key>", "commandtype":"addtrigger.","success":"false","data":{"ruleid":"<ruleid>"}}
+
  {
  2 - {"mii":"<random key>", "commandtype":"addtrigger.","success":"false"}
+
  "mii":"<random key>","commandtype":"getdeviceindex","success":"false"
<br />
+
  }
 
Example
 
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 />
+
In the following example, value of index 1 is retrieved for device id 2.
  {
+
  {  
  "mii":"udfh",  
+
  "mii":"jdnbc",  
  "cmd":"addtrigger",
+
  "cmd":"getdeviceindex",
  "ruleid":"2",
+
  "devid":"2",
  "triggertype":"EventTrigger",
+
  "index":"1"
  "eventid":"1",
+
  "eventtype":"AlmondModeUpdated",
+
  "eventval":"home",
+
  "grouping":"AND",
+
  "condition":"eq",
+
  "duration":"50"
+
 
  }
 
  }
<br />
 
 
Response
 
Response
  {
+
  {
   "mii":"udfh", "CommandType":"addtrigger.","success":"true","data":{"ruleid":"2"}
+
   "mii":"jdnbc","commandtype":"getdeviceindex","success":"true","data":{"devid":"2","index":"1","value":"false"}
 
  }
 
  }
<br />
+
 
====TimeTrigger====
+
===Editdevicename===
Command to add a time based trigger.<br />
+
Command to edit name and location of a device.<br />
Request
+
Request<br />
  {
+
  {  
   "mii":"<random key>",  
+
   "mii":"<random key>",
   "cmd":"addtrigger",
+
   "cmd":"editdevicename",
   "ruleid":"<ruleid>",
+
   "devid":"6",
  "triggertype":"<type of trigger>",
+
   "name":"newswitchsss",
  "hours":"<hours>",
+
   "location":"default"
  "mins":"<minutes>",
+
  "dayofmonth":"<1-31,*>",
+
  "monthofyear":"<0-11,*>",
+
  "dayofweek":"<0-6,*>",
+
   "grouping":"< AND/OR>",
+
   "range":"<time in min>"
+
 
  }
 
  }
 
Response<br />
 
Response<br />
 
Success
 
Success
  {
+
  {
   "mii":"<random key>","commandtype":"addtrigger.","success":"true","data":{"ruleid":"<ruleid>"}
+
   "mii":"<random key>","commandtype":"editdevicename","success":"true"
 
  }
 
  }
 
Failure
 
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",
+
  "mii":"<random key>","commandtype":"editdevicename","success":"false"
  "cmd":"addtrigger",
+
  "ruleid":"2",
+
  "triggertype":"TimeTrigger",
+
  "hours":"1",
+
  "mins":"10",
+
  "dayofmonth":"*",
+
  "monthofyear":"*",
+
  "dayofweek":"1,2,3",
+
  "grouping":"AND",
+
  "range":"50"
+
 
  }
 
  }
Response
+
 
{
+
===Updatealmondmode===
  "mii":"jdfvg","CommandType":"addtrigger.","success":"true","data":{"ruleid":"2"}
+
Command to change the almond mode.<br />
}
+
Request<br />
<br />
+
  {
===Removetrigger===
+
   "mii":"<random key>",
Command to remove a trigger in a rule.<br />
+
   "cmd":"updatealmondmode",
Request
+
   "mode":"<mode i.e.  2/3>",
  {  
+
   "emailid":"<email id>"
   "mii":"<random key>",  
+
   "cmd":"removetrigger",
+
   "ruleid":"<ruleid>",
+
   "triggerid":"<triggerid>"
+
 
  }
 
  }
 
Response<br />
 
Response<br />
 
Success
 
Success
 
  {
 
  {
   "mii":"<random key>", "commandtype":"removetrigger.","success":"true","data":{"ruleid":"<ruleid>" ,"triggerid":"<triggerid>"}
+
   "mii":"<random key>","commandtype":"updatealmondmode","success":"true","data":{"mode":"2","emailid":"swetha.reddy@securifi.com"}
 
  }
 
  }
 
<br />
 
<br />
 
Failure
 
Failure
  1 - {"mii":"<random key>","commandtype":"removetrigger.""success":"false","data":{"ruleid":"<ruleid>" ,"triggerid":"<triggerid>"}}
+
  {
  2 - {"mii":"<random key>","commandtype":"removetrigger.","success":"false"}
+
  "mii":"<random key>","commandtype":"updatealmondmode","success":"false"
 +
  }  
 
<br />
 
<br />
Example<br />
+
==Rules Commands==
In the following example, a trigger with triggerid 1 is removed from ruleid 2.<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===
  "mii":"yvgedc",
+
Command to get the list of existing rules.<br /><br />
  "cmd":"removetrigger",
+
Request:<br />
  "ruleid":"2",
+
  {“CommandType":"RuleList","MobileInternalIndex":"123"}
  "triggerid":"1"
+
}
+
 
<br />
 
<br />
Response<br />
+
 
 +
Response:<br />
 +
{"CommandType":"RuleList" ,"Rules":[{"ID":"1","Name":"12346","Valid":"1","Triggers":[{"Type":"EventTrigger","EventType":"AlmondModeUpdated","ID":"1","Grouping":"AND","Condition":"eq","Validation":"true","Value":"home"},
 +
{ "Type":"DeviceTrigger","ID":"1","Index":"1","Grouping":"AND","Validation":"true","Condition":"eq","Value":"false"}],"Results":[{"Type":"EventResult","EventType":"AlmondModeUpdated","ID":"1","PreDelay":"0",
 +
"Validation":"true","Value":"away"},{"Type":"DeviceResult","ID":"2","Index":"1","PreDelay":"0","Validation":"true","Value":"false"}]}]}
 +
<br />
 +
 
 +
===Addrule===
 +
Command to create a new rule.<br />
 +
Request<br />
 
  {
 
  {
   "mii":"yvgedc","commandtype":"removetrigger.","success":"true","data":{"ruleid":"2" ,"triggerid":"1"}
+
   "MobileInternalIndex": "111",
 +
  "CommandType": "AddRule",
 +
  "Name": "MYRULE",
 +
  "Valid":"true",
 +
  "Triggers": [
 +
{
 +
  "Type": "DeviceTrigger",
 +
  "ID": "1",
 +
  "Index": "1",
 +
  "Value": "true",
 +
  "Grouping": "AND", 
 +
  "Condition": "eq",
 +
  "Validation": "true"
 +
},
 +
{
 +
  "Type": "EventTrigger",
 +
  "ID": "1",
 +
  "EventType": "AlmondModeUpdated",
 +
  "value": "home",
 +
  "Grouping": "AND",
 +
  "Condition": "eq"
 
  }
 
  }
===Removealltriggers===
+
],
Command to remove all triggers in a rule.<br />
+
  "Results": [
Request<br />
+
  {
  {
+
   "Type": "DeviceResult",
   "mii":"<random key>",
+
   "ID": "2",
   "cmd":"removealltriggers",
+
   "Index": "1",
   "ruleid":"<ruleid>"
+
  "Value": "true",
}
+
  "PreDelay": "10"
<br />
+
},
Response<br />
+
Success
+
 
  {
 
  {
   "mii":"<random key>","commandtype":"removealltriggers.","success":"true","data":{"ruleid":"<ruleid>"}
+
   "Type": "EventResult",
 +
  "ID": "1",  
 +
  "EventType": "AlmondModeUpdated",
 +
  "Value": "away",
 +
  "PreDelay": "0"  
 
  }
 
  }
Failure
+
  ]
  1 - {"mii":"<random key>","commandtype":"removealltriggers.","success":"false","data":{"ruleID":"<ruleid>"}}
+
  }<br /><br />
  2 - {"mii":"<random key>","commandtype":"removealltriggers.","success":"false"}
+
<br />
+
Example<br />
+
In the following command, all triggers from ruleid 1 are removed<br />
+
+
  "mii":"dfnc",
+
  "cmd":"removealltriggers",
+
  "ruleid":"1"
+
}
+
<br />
+
 
Response<br />
 
Response<br />
 +
 
  {
 
  {
   "mii":"dfnc","commandtype":"removealltriggers.","success":"true","data":{"ruleid":"1"}
+
   "CommandType":"AddRule",
 +
  "Success":"true",
 +
  "MobileInternalIndex":"111",
 +
  "ReasonCode":"1"
 
  }
 
  }
 
<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 />
+
===Updaterule===
====DeviceResult====
+
Command to update an existing rule.<br />
Command to add DeviceResult to a rule.<br />
+
 
Request<br />
 
Request<br />
 +
{
 +
  "MobileInternalIndex": "111",
 +
  "CommandType": "UpdateRule",
 +
  "Name": "UPATERULE",
 +
  "Valid":"true",
 +
  "ID": "1",
 +
  "Triggers": [
 
  {  
 
  {  
  "mii":"<random key>",
+
  "Type": "DeviceTrigger",
  "cmd":"addresult",
+
  "ID": "1",
  "ruleid":"<ruleid>",
+
  "Index": "1",
  "resulttype":"<type of result>",
+
  "Value": "true",
  "deviceid":"<device id>",
+
  "Grouping": "AND",
  "deviceindex":"<device index>",
+
  "Condition": "eq"
  "indexvalue":"<index value>",
+
},
  "predelay":"<time in sec>"
+
{
 +
  "Type": "EventTrigger",
 +
  "ID": "1",
 +
  "EventType": "AlmondModeUpdated",
 +
  "Value": "home",
 +
  "Grouping": "AND",
 +
  "Condition": "eq"
 
  }
 
  }
Response<br />
+
],
Success
+
"Results": [
 
  {
 
  {
   "mii":"<random key>","commandtype":"addresult ","success":"true","data":{"ruleid":"<ruleid>"}
+
   "Type": "DeviceResult",
}
+
   "ID": "2",
Failure
+
   "Index": "1",
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
+
   "Value": "true",
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
+
   "PreDelay": "10"
<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 />
+
 
  {
 
  {
   "mii":"teyuwio#$%^","commandtype":"addresult ","success":"true","data":{"ruleid":"2"}
+
   "Type": "EventResult",
 +
  "ID": "1",
 +
  "EventType": "AlmondModeUpdated",
 +
  "Value": "away",
 +
  "PreDelay": "10"
 
  }
 
  }
====EventResult====
+
  ]
Command to add an EventResult to a rule.<br />
+
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>"
+
 
  }
 
  }
 +
 +
<br />
 
Response<br />
 
Response<br />
Success
 
 
  {
 
  {
   "mii":"<random key>","commandtype":"addresult ","success":"true","data":{"ruleid":"<ruleid>"}
+
   "CommandType":"UpdateRule",
 +
  "Success":"true",
 +
  "MobileInternalIndex":"111",
 +
  "ReasonCode":"1"
 
  }
 
  }
Failure
+
<br />
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
+
 
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
+
===Removerule===
Example<br />
+
Command to remove an existing rule.<br />
In the following example, an EventResult is added to a rule with ruleid=2.<br />
+
Request<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"}
+
   "CommandType": "RemoveRule",
}
+
   "Rules": {
====SceneResult====
+
   "ID": "1"
Command to add SceneResult to rule.<br />
+
},
Request
+
   "MobileInternalIndex": "111"
+
   "mii":"<random key>",
+
   "cmd":"addresult",
+
  "ruleid":"<ruleid>",
+
  "resulttype":"SceneResult",
+
  "sceneid":"<sceneid>",
+
   "predelay":"<time in sec>"
+
 
  }
 
  }
 
<br />
 
<br />
 
Response<br />
 
Response<br />
Success
 
 
  {
 
  {
   "mii":"<random key>","commandtype":"addresult ","success":"true","data":{"ruleid":"<ruleid>"}
+
   "CommandType":"RemoveRule",
 +
  "Success":"true",
 +
  "MobileInternalIndex":"111",
 +
  "ReasonCode":"0"
 
  }
 
  }
Failure
 
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
 
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
 
 
<br />
 
<br />
====NetworkResult====
+
 
Command to add NetworkResult to rule.<br />
+
 
Request
+
===Removeallrules===
  {
+
Command to remove all rules.<br />
   "mii":"<random key>",
+
Request<br />
   "cmd":"addresult",
+
  {
  "ruleid":"<ruleid>",
+
   "CommandType":"RemoveAllRules",
  "resulttype":"NetworkResult",
+
   "MobileInternalIndex":"111"
  "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":"RemoveAllRules",
}
+
  "Success":"true",
Failure
+
  "MobileInternalIndex":"111",
1 - {"mii":"<random key>","commandtype":"addresult ","success":"false","data":{"ruleid":"<ruleid>"}}
+
  "ReasonCode":"0"
2 - {"mii":"<random key>","commandtype":"addresult ","success":"false"}
+
}
===Removeresult===
+
<br />
Command to remove result in a rule.<br />
+
 
Request
+
 
  {  
+
===Validaterule===
  "mii":"<random key>",  
+
Command to validate an existing rule.<br />
  "cmd":"removeresult",
+
Request<br />
  "ruleid":"<ruleid>",
+
  {
  "resultid":"<resultid>"
+
  "CommandType":"ValidateRule",
 +
  "ID":"1",
 +
  "Value":"true"
 +
  "MobileInternalIndex":"111"
 
  }
 
  }
 
<br />
 
<br />
 
Response<br />
 
Response<br />
Success
 
 
  {
 
  {
   "mii":"<random key>","commandtype":"removeresult","success":"true","data":{"ruleid":"<ruleid>", "resultid":"<resultid>"}
+
   "CommandType":"ValidateRule",
 +
  "MobileInternalIndex":"111",
 +
  "ReasonCode":"0",
 +
  "Success":"false",
 +
  "Data":{
 +
  "Value":"true",
 +
  "ID":"1"
 
  }
 
  }
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"}
 
 
  }
 
  }
 +
<br />
  
===Removeallresults===
+
 
Command to remove all results in a rule.<br/>
+
==ClientList==
 +
Command to get clientlist.<br/>
 
Request
 
Request
 
  {   
 
  {   
  "mii":"<random key>",
+
  "MobileInternalIndex":"<random key>",
  "cmd":"removeallresults",
+
  "CommandType":"ClientList"
  "ruleid":"<ruleid>"
+
 
  }
 
  }
 +
 
Response
 
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",
+
  "MobileInternalIndex":"<random key>",
  "cmd":"removeallresults",
+
  "CommandType":"ClientList",
  "ruleid":"2"
+
  "Success":"true",
 +
  "Clients":[ 
 +
    { 
 +
      "ID":"1",
 +
      "Name":"iphone_4s",
 +
      "Connection":"wireless",
 +
      "MAC":"other",
 +
      "Type":"other",
 +
      "LastKnownIP":"10.2.2.11",
 +
      "Active":"false",
 +
      "UseAsPresence":"true",
 +
      "LastActiveEpoch":"1433920922",
 +
      "Wait":"6"
 +
    },
 +
    { 
 +
      "ID":"2",
 +
      "Name":"buildserver.lan",
 +
      "Connection":"wired",
 +
      "MAC":"d8:50:e6:54:1b:9c",
 +
      "Type":"other",
 +
      "LastKnownIP":"10.10.10.1",
 +
      "Active":"true",
 +
      "UseAsPresence":"false",
 +
      "LastActiveEpoch":"1433920922",
 +
      "Wait":"6"
 +
    }
 +
  ]
 
  }
 
  }
Response<br/>
+
 
{
+
Note - Success Tag in response:<br/>
  "mii":"teoncwsi","commandtype":"removeallresults","success":"true","data":{"ruleid":"2"}
+
If the Almond is in AP mode or Range Extender mode then Success tag will be set to ‘false’.<br/>
}
+
 
<br/>
+
===UpdateClient===
===Validaterule===
+
Command to Update the data of a client. <br/>
Command to enable or disable a rule.<br/>
+
ID - Clientid <br/>
Request
+
Name - name of the client<br/>
 +
Connection - wired/wireless<br/>
 +
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<br/>
 +
Request<br/>
 
  {   
 
  {   
   "mii":"<random key>",
+
   "MobileInternalIndex":"<random key>",
   "cmd":"validaterule",
+
   "CommandType":"UpdateClient",
   "ruleid":"<ruleid>",
+
   "Clients":
  "value":"<value>"
+
    "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/>
 
Response<br/>
Success<br/> 
+
Success
If rule is valid<br/>
+
 
  {
 
  {
   "mii":"<random key>","commandtype":"validaterule","success":"true","data":{"value":"true","ruleid":"<ruleid>"}
+
   "CommandType":"UpdateClient",
 +
  "MobileInternalIndex":"324",
 +
  "Success":"true",
 +
  "ReasonCode":"0"
 
  }
 
  }
<br/>
+
Faliure
If rule is invalid<br/>
+
 
  {
 
  {
   "mii":"<random key>","commandtype":"validaterule","success":"true","data":{"value":"false","ruleid":"<ruleid>"}
+
   "CommandType":"UpdateClient",
 +
  "MobileInternalIndex":"324",
 +
  "Success":"false",
 +
  "ReasonCode":"0"
 
  }
 
  }
  
Failure<br/>
+
===Remove client===
{"mii":"<random key>","commandtype":"validaterule","success":"false","data":{"ruleid":"<ruleid>"}}}
+
command to remove a client.<br/>
{"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
 
Request
 
  {   
 
  {   
   "mii":"<random key>",
+
   "MobileInternalIndex":"<random key>",
   "cmd":"setpredelay",
+
   "CommandType":"RemoveClient",
   "ruleid":"<ruleid>",
+
   "Clients":
  "resultid":"<resultid>"
+
    "ID":"1",
 +
    "MAC":"1c:75:08:32:2a:6d"
 +
  }
 
  }
 
  }
 
Response<br/>
 
Response<br/>
 
Success
 
Success
 
  {
 
  {
   "mii":"<random key>","commandtype":"setpredelay","success":"true","data":{"ruleid":”<ruleid>"}
+
   "CommandType":"RemoveClient",  
 +
  "MobileInternalIndex":"324",
 +
  "Success":"true",
 +
  "ReasonCode":"0"  
 
  }
 
  }
 
Failure
 
Failure
  1 - {"mii":"<random key>","commandtype":"setpredelay","success":"false","data":{"ruleid":”<ruleid>"}}
+
  {
  2 - {"mii":"<random key>","commandtype":"setpredelay","success":"false"}
+
  "CommandType":"RemoveClient",
 +
  "MobileInternalIndex":"324",
 +
  "Success":"false",
 +
  "ReasonCode":"0"
 +
  }
  
===Setrulename===
+
===Removeallclients===
Command to change the name of an existing rule.<br/>
+
Command to remove all clients<br/>
 
Request
 
Request
 
  {   
 
  {   
   "mii":"<random key>",
+
   "MobileInternalIndex":"<random key>",
   "cmd":"setrulename",
+
   "CommandType":"RemoveAllClients",
  "ruleid":"<ruleid>",
+
  "rulename":"<name of rule>"
+
 
  }
 
  }
 
Response<br/>
 
Response<br/>
 
Success
 
Success
 
  {
 
  {
   "mii":"<random key>","commandtype":"setrulename","success":"true","data":{"ruleid":"<ruleid>","rulename":"<nameof rule>}
+
   "CommandType":"RemoveAllClients",
 +
  "MobileInternalIndex":"324",
 +
  "Success":"true",
 +
  "ReasonCode":"0"
 
  }
 
  }
 
Failure
 
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}}
+
   "CommandType":"RemoveAllClients",
 +
  "MobileInternalIndex":"324",
 +
  "Success":"false",
 +
  "ReasonCode":"0"
 
  }
 
  }
 +
<br/>
 +
==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<br/>
  
===Deleteallrules===
+
===SceneList===
Command to delete all rules.<br/>
+
Command to retrieve the list of existing Scenes.<br/>
 
Request
 
Request
  {
+
  {  
  "mii":"<random key>",
+
  "MobileInternalIndex":"<random key>",
  "cmd":"deleteallrules",
+
  "CommandType":"DynamicSceneList"
 
  }
 
  }
 +
 
Response<br/>
 
Response<br/>
{"mii":"<random key>","commandtype":"deleteallrules","success":"true"}
+
Note: Active :- Indicates the state of Scene<br/>
 
+
===Newrule===
+
command to create a new rule.<br/>
+
Request
+
 
  {   
 
  {   
   "mii":"<random key>",
+
   "MobileInternalIndex":"<random key>",
   "cmd":"newrule",
+
   "CommandType":"DynamicSceneList",
   "rulename":"<rulename>",
+
   "Scenes":
  "triggers":"<num of triggers>",
+
    { 
  "trigger":
+
      "ID":"1",
    "1":{   
+
      "Name":"Scene1",
      "triggertype":"<type of trigger>",
+
      "LastActiveEpoch":"1433740885",
      "deviceid":"<device id>",
+
      "Active":"false",
      "deviceindex":"<device index>",
+
      "SceneEntryList":[ 
      "indexvalue":"<index value>",
+
        {   
      "grouping":"< AND/OR>",
+
          "DeviceID":"2",
      "condition":"<condition type ie.eq/le/ge/lt/gt>",
+
          "Index":"2",
      "duration":"<time in sec>"
+
          "Value":"true",
 +
          "Valid":"false"
 +
        },
 +
        { 
 +
          "DeviceID":"1",
 +
          "Index":"2",
 +
          "Value":"true",
 +
          "Valid":"false"
 +
        }
 +
      ]
 
     },
 
     },
     "2":{   
+
     {   
       "triggertype":"<type of trigger>",
+
       "ID":"2",
       "eventid":"<event id>",
+
       "Name":"Scene2",
      "eventtype":"<event type>",
+
      "LastActiveEpoch":"0",
      "eventval":"<event value>",
+
      "Active":"false",
       "grouping":"<AND/OR>",
+
       "SceneEntryList":[  
      "condition":"<condition type ie.eq/le/ge/lt/gt>",
+
        {   
    "duration":"<time in sec>"
+
          "DeviceID":"6",
    }
+
          "Index":"1",
    },
+
          "Value":"true",
    "results":"<num of results>",
+
          "Valid":"false"
    "result":{  
+
        },
    "1":{   
+
        {   
      "resulttype":"<type of result>",
+
          "DeviceID":"7",
      "deviceid":"<device id>",
+
          "Index":"1",
      "deviceindex":"<device index>",
+
          "Value":"true",
      "indexvalue":"<index value>",
+
          "Valid":"false"
      "predelay":"<time in sec>"
+
        }
    },
+
       ]
    "2":{   
+
      "resulttype":"<type of result>",
+
      "eventid":"<event id>",
+
      "eventtype":"<event type>",
+
      "eventval":"<event value>",
+
       "predelay":"<time in sec>"
+
 
     }
 
     }
  }
+
   ]
   }
+
  }
Response<br/>
+
===AddScene===
Success
+
Command to add a new Scene.<br/>
  {"mii":"<random key>","commandtype":"newrule","success":"true"}
+
Request
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",
+
   "CommandType":"AddScene",
   "cmd":"newrule",
+
   "MobileInternalIndex":"324",
   "rulename":"myrule",
+
   "Scenes":{   
  "triggers":"2",
+
     "Name":"My_created_scene",
  "trigger":{   
+
     "SceneEntryList":[  
     "1":{ 
+
       {   
      "triggertype":"DeviceTrigger",
+
        "DeviceID":"1",
      "deviceid":"6",
+
        "Index":"1",
      "deviceindex":"1",
+
        "Value":"false"
      "indexvalue":"true",
+
       },
      "grouping":"AND",
+
      {   
      "condition":"eq"
+
        "DeviceID":"2",
    },
+
        "Index":"2",
     "2":{  
+
        "Value":"false"
       "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/>
+
Response
  {"mii":"87y68gdr","commandtype":"newrule","success":"true"}
+
  {"CommandType":"AddScene","MobileInternalIndex":"324","Success":"true","Reason":"0"}
  
===Editrule===
+
===UpdateScene===
Command to edit existing rule.<br/>
+
Command to update an existing Scene<br/>
 
Request
 
Request
  {  
+
  {
   "mii":"<random key>",  
+
   "CommandType":"UpdateScene",
   "cmd":"editrule",
+
   "MobileInternalIndex":"324",
   "ruleid":"<rule id>",
+
   "Scenes":
  "rulename":"<rule name>",
+
    "ID":"15",
  "triggers":"<num of triggers>",
+
    "Name":"My_created_scene",
  "trigger":{  
+
    "SceneEntryList":[  
    "1":{   
+
      {   
      "triggertype":"<type of trigger>",
+
        "DeviceID":"1",
      "deviceid":"<device id>",
+
        "Index":"1",
      "deviceindex":"<device index>",
+
        "Value":"false"
       "indexvalue":"<index value>",
+
       },
       "grouping":"<AND/OR>",
+
       {   
      "condition":"<condition type ie.eq/le/ge/lt/gt>"
+
        "DeviceID":"2",
      "duration":"<time in sec>"
+
        "Index":"2",
      },
+
        "Value":"false"
    "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
+
Response
  {"<random key>":"dfnc","commandtype":"editrule","success":"true"}
+
{"CommandType":"UpdateScene","MobileInternalIndex":"324","Success":"true","Reason":"0"}
Failure
+
 
  {"mii":"<random key>","commandtype":"editrule","success":"false"}
+
===ActivateScene===
 +
Command to activate a Scene<br/>
 +
Request
 +
  {
 +
  "CommandType":"ActivateScene",
 +
  "MobileInternalIndex":"324",
 +
  "Scenes":
 +
    "ID":"11"
 +
  }
 +
}
 +
 
 +
Response
 +
  {"CommandType":"ActivateScene","MobileInternalIndex":"324","Success":"true","Reason":"0"}
 
<br/>
 
<br/>
Example
+
===RemoveScene===
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/>
+
Command to remove a Scene<br/>
{
+
Request
  "mii":"dhcb",
+
  {   
  "cmd":"editrule",
+
  "CommandType":"RemoveScene",
  "ruleid":"1",
+
   "MobileInternalIndex":"324",
  "rulename":"changingrulename",
+
   "Scenes":{   
  "triggers":"2",
+
     "ID":"11"
  "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
 
Response
  {"mii":"dhcb","commandtype":"editrule","success":"true"}
+
  {"CommandType":"RemoveScene","MobileInternalIndex":"324","Success":"true","Reason":"0"}
 +
 
 +
===RemoveAllScenes===
 +
Command to remove all Scenes<br/>
 +
Request
 +
 +
  "CommandType":"RemoveAllScenes",
 +
  "MobileInternalIndex":"324"
 +
}
 +
Response
 +
{"CommandType":"RemoveAllScenes","MobileInternalIndex":"324","Success":"true","Reason":"0"}
  
 
==Notification and Event Updates==
 
==Notification and Event Updates==
  
 +
===SensorUpdate===
 +
When any index value is changed the following update will be received.<br/>
 +
{"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"}}}}
  
===RuleAdded===
+
===DeviceAdded===
When a new rule is added the following update is received.
+
When a new device is added the following update will be received.
  {"commandtype":"RuleAdded","ruleid":"<ruleid>"}
+
  {"commandtype":"DeviceAdded","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":"DeviceAdded","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"}}}}}
 +
 
 +
===DeviceRemoved===
 +
When a device is removed the following update will be received
 +
{"commandtype":"DeviceRemoved","data":{"<device id>":{"devtype":"<device type>"}}}
 
Example
 
Example
  {"commandtype":"RuleAdded","ruleid":"1"}
+
  {"commandtype":"DeviceRemoved","data":{"25":{"devtype":"12"}}}
 +
 
 +
===DeviceRemoveAll===
 +
When all the devices are removed the following update will be received.
 +
{"commandtype":"DeviceRemoveAll"}
 +
 
 +
===DeviceUpdated===
 +
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"}}}}}
 +
 
 +
===DynamicRuleAdded===
 +
 
 +
When a new rule is added the following update is received.
 +
 
 +
{
 +
  "CommandType": "DynamicRuleAdded",
 +
  "Rules": {
 +
  "ID": "1",
 +
  "Name": "NewRule",
 +
  "Valid": "1",
 +
  "Triggers": [{
 +
  "Type": "EventTrigger",
 +
  "EventType": "AlmondModeUpdated",
 +
  "ID": "1",
 +
  "Grouping": "AND",
 +
  "Condition": "eq",
 +
  "Validation": "true",
 +
  "Value": "home"
 +
  }, {
 +
  "Type": "DeviceTrigger",
 +
  "ID": "2",
 +
  "Index": "1",
 +
  "Grouping": "AND",
 +
  "Validation": "true",
 +
  "Condition": "eq",
 +
  "Value": "false"
 +
}],
 +
  "Results": [{
 +
  "Type": "DeviceResult",
 +
  "ID": "2",
 +
  "Index": "1",
 +
  "PreDelay": "0",
 +
  "Validation": "true",
 +
  "Value": "false"
 +
}, {
 +
  "Type": "EventResult",
 +
  "EventType": "AlmondModeUpdated",
 +
  "ID": "1",
 +
  "PreDelay": "0",
 +
  "Validation": "true",
 +
  "Value": "away"
 +
}]
 +
}
 +
}
 +
 
 +
<br/>
 +
 
 +
===DynamicRuleUpdated===
 +
 
 +
When an existing rule is modified the following update is received.
 +
{
 +
  "CommandType": "DynamicRuleUpdated",
 +
  "Rules": {
 +
  "ID": "1",
 +
  "Name": "123",
 +
  "Valid": "1",
 +
  "Triggers": [{
 +
  "Type": "EventTrigger",
 +
  "EventType": "AlmondModeUpdated",
 +
  "ID": "1",
 +
  "Grouping": "AND",
 +
  "Condition": "eq",
 +
  "Validation": "true",
 +
  "Value": "home"
 +
}, {
 +
  "Type": "DeviceTrigger",
 +
  "ID": "2",
 +
  "Index": "1",
 +
  "Grouping": "AND",
 +
  "Validation": "true",
 +
  "Condition": "eq",
 +
  "Value": "false"
 +
}],
 +
  "Results": [{
 +
  "Type": "DeviceResult",
 +
  "ID": "2",
 +
  "Index": "1",
 +
  "PreDelay": "0",
 +
  "Validation": "true",
 +
  "Value": "false"
 +
}, {
 +
  "Type": "EventResult",
 +
  "EventType": "AlmondModeUpdated",
 +
  "ID": "1",
 +
  "PreDelay": "0",
 +
  "Validation": "true",
 +
  "Value": "away"
 +
}]
 +
}
 +
}
 +
 
 +
<br/>
 +
 
 +
===DynamicRuleRemoved===
  
===RuleRemoved===
 
 
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","Rules":{"ID":"1"}
 +
}
 +
<br/>
 +
 
 +
===DynamicAllRulesRemoved===
 +
 
 +
When all rules are removed the following update is received.
 +
 
 +
  {
 +
  "CommandType":"DynamicAllRulesRemoved"
 +
}
  
===RuleUpdated===
+
<br/>
When a rule is updated the following update is received.
+
 
  {"commandtype":"RuleUpdated","ruleid":"<ruleid>"}
+
===AlmondModeUpdated===
 +
  {"commandtype":"AlmondModeUpdated","data":{"<almond mode >":{"emailid":"<email id>"}}}
 
Example
 
Example
  {"commandtype":"RuleUpdated","ruleid":"1"}
+
  {"commandtype":"AlmondModeUpdated","data":{"2":{"emailid":"swetha.reddy@securifi.com"}}}
 +
 
 +
===DynamicClientAdded===
 +
When a new client is added this update is received.
 +
 +
  "CommandType":"DynamicClientAdded",
 +
  "Clients":{ 
 +
    "ID":"1",
 +
    "Name":"my phone",
 +
    "Connection":"wired",
 +
    "MAC":"c4:43:6d:c9:ef:05",
 +
    "Type":"tv",
 +
    "LastKnownIP":"10.10.10.55",
 +
    "Active":"false",
 +
    "UseAsPresence":"true",
 +
    "Wait":"6"
 +
  }
 +
}
 +
 
 +
===DynamicClientJoined===
 +
When a client joined network this update is received.
 +
 +
  "CommandType":"DynamicClientJoined",
 +
  "Clients":{ 
 +
    "ID":"1",
 +
    "Name":"my phone",
 +
    "Connection":"wired",
 +
    "MAC":"c4:43:6d:c9:ef:05",
 +
    "Type":"tv",
 +
    "LastKnownIP":"10.10.10.55",
 +
    "Active":"false",
 +
    "UseAsPresence":"true",
 +
    "Wait":"6"
 +
  }
 +
}
 +
 
 +
 
 +
===DynamicClientLeft===
 +
When a client leaves the network, following update is received.
 +
 +
  "CommandType":"DynamicClientLeft",
 +
  "Clients":{ 
 +
    "ID":"1",
 +
    "Name":"my phone",
 +
    "Connection":"wired",
 +
    "MAC":"c4:43:6d:c9:ef:05",
 +
    "Type":"tv",
 +
    "LastKnownIP":"10.10.10.55",
 +
    "Active":"false",
 +
    "UseAsPresence":"true",
 +
    "Wait":"6"
 +
  }
 +
}
 +
 
 +
===DynamicClientUpdated===
 +
When a name change or any changes done to a client this update is received.
 +
 
 +
 +
  "CommandType":"DynamicClientUpdated",
 +
  "Clients":{ 
 +
    "ID":"1",
 +
    "Name":"my phone",
 +
    "Connection":"wired",
 +
    "MAC":"c4:43:6d:c9:ef:05",
 +
    "Type":"tv",
 +
    "LastKnownIP":"10.10.10.55",
 +
    "Active":"false",
 +
    "UseAsPresence":"true",
 +
    "Wait":"6"
 +
  }
 +
}
 +
 
 +
===DynamicClientRemoved===
 +
When a client is removed this update is received
 +
{"CommandType":"DynamicClientRemoved","ID":"1","MAC":"c4:43:6d:c9:ef:05"}
 +
 
 +
===DynamicAllClientsRemoved===
 +
When all the clients are removed this update is received
 +
{"CommandType":"DynamicAllClientsRemoved"}
 +
 
 +
===DynamicSceneAdded===
 +
when a new scene is added this update is received.
 +
 +
  "CommandType":"DynamicSceneAdded",
 +
  "Scenes":{ 
 +
    "ID":"1",
 +
    "Name":"My_created_scene",
 +
    "LastActiveEpoch":"8295685751190847488",
 +
    "Active":"false",
 +
    "SceneEntryList":[ 
 +
    {"DeviceID":"1","Index":"1","Value":"false","Valid":"true"},
 +
    {"DeviceID":"1","Index":"2","Value":"false","Valid":"false"}
 +
    ]
 +
  }
 +
}
 +
 
 +
===DynamicSceneUpdated===
 +
when any changes are made to existing scene this update is received.
 +
 +
  "CommandType":"DynamicSceneUpdated",
 +
  "Scenes":{ 
 +
    "ID":"1",
 +
    "Name":"My_created_scene",
 +
    "LastActiveEpoch":"8295685751190847488",
 +
    "Active":"false",
 +
    "SceneEntryList":[ 
 +
      {"DeviceID":"2","Index":"1","Value":"false","Valid":"true"},
 +
      {"DeviceID":"4","Index":"1","Value":"78","Valid":"false"}
 +
    ]
 +
  }
 +
}
 +
 
 +
===DynamicSceneActivated===
 +
when any scene is activated this update is received.
 +
 +
  "CommandType":"DynamicSceneActivated",
 +
  "Scenes":{ 
 +
    "ID":"1",
 +
    "LastActiveEpoch":"8295685751190847488",
 +
    "Active":"true",
 +
}  }
 +
 
 +
===DynamicSceneRemoved===
 +
when any scene is removed this update is received.
 +
 +
  "CommandType":"DynamicSceneRemoved",
 +
  "Scenes":{ 
 +
    "ID":"1"
 +
  }
 +
}
  
===RuleRemoveAll===
+
===DynamicAllScenesRemoved===
When all the rules are removed the following update is received.
+
when all scenes are removed this update is received.
  {"commandtype":"RuleRemoveAll"}
+
  {"CommandType":"DynamicAllScenesRemoved"}

Latest revision as of 12:38, 30 August 2016

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

{  
 "mii":"<random key>",
 "cmd":"devicelist"
}

Response

{ 
 "mii":"<random key>","commandtype":"devicelist","data" : {"1":{"devicename":"ContactSwitch #1","friendlydevicetype":"ContactSwitch","devicetype":"12","deviceid":"1","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"}}},"2":{"devicename":"BinarySwitch 
 #2","friendlydevicetype":"BinarySwitch","devicetype":"1","deviceid":"2","location":"Default","devicevalues":{"1":{"index":"1","name":"SWITCH BINARY","value":"true"}}}}
}

Setdeviceindex

Command to set the device index value without timeout.

Request

{  
 "mii":"<random key>",
 "cmd":"setdeviceindex",
 "devid":"<device id>",
 "index":"<deviceindex>",
 "value":"<indexvalue>"
}

Response
Success

{ 
 "mii":"<random key>","commandtype":"setdeviceindex","success":"true","data":{"devid":"<deviceid>","index":"<deviceindex>","value":"<indexvalue>"}
}

Failure

{
 "mii":"<random key>","commandtype":"setdeviceindex",:"success":"false"}
}


Example
In the following example, the value of index 1 is set to ‘true’ for device id 2.

{
 "mii":"jdnbc",
 "cmd":"setdeviceindex",
 "devid":"2",
 "index":"1",
 "value":"true",
}

Response

{
 "mii":"jdnbc","commandtype":"setdeviceindex","success":"true","data":{"devid":"2","index":"1","value":"true"}
}

Getdeviceindex

Command to get the value of a device index. Request

{  
 "mii":"<random key>",
 "cmd":"getdeviceindex",
 "devid":"<deviceid>",
 "index":"<deviceindex>"
}

Response
Success

{
 "mii":"<random key>","commandtype":"getdeviceindex","success":"true","data":{"devid":"<deviceid>","index":"<deviceindex>","value":"<indexvalue>"}
}

Failure

{
 "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

Command to edit name and location of a device.
Request

{ 
 "mii":"<random key>",
 "cmd":"editdevicename",
 "devid":"6",
 "name":"newswitchsss",
 "location":"default"
}

Response
Success

{  
 "mii":"<random key>","commandtype":"editdevicename","success":"true"
}

Failure

{  
 "mii":"<random key>","commandtype":"editdevicename","success":"false"
}

Updatealmondmode

Command to change the almond mode.
Request

{
  "mii":"<random key>",
  "cmd":"updatealmondmode",
  "mode":"<mode i.e.  2/3>",
  "emailid":"<email id>"
}

Response
Success

{
 "mii":"<random key>","commandtype":"updatealmondmode","success":"true","data":{"mode":"2","emailid":"swetha.reddy@securifi.com"}
}


Failure

{
 "mii":"<random key>","commandtype":"updatealmondmode","success":"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":"123"}


Response:

{"CommandType":"RuleList" ,"Rules":[{"ID":"1","Name":"12346","Valid":"1","Triggers":[{"Type":"EventTrigger","EventType":"AlmondModeUpdated","ID":"1","Grouping":"AND","Condition":"eq","Validation":"true","Value":"home"},
{ "Type":"DeviceTrigger","ID":"1","Index":"1","Grouping":"AND","Validation":"true","Condition":"eq","Value":"false"}],"Results":[{"Type":"EventResult","EventType":"AlmondModeUpdated","ID":"1","PreDelay":"0",
"Validation":"true","Value":"away"},{"Type":"DeviceResult","ID":"2","Index":"1","PreDelay":"0","Validation":"true","Value":"false"}]}]}


Addrule

Command to create a new rule.
Request

{
 "MobileInternalIndex": "111",
 "CommandType": "AddRule",
 "Name": "MYRULE",
 "Valid":"true",
 "Triggers": [
{
 "Type": "DeviceTrigger",
 "ID": "1",
 "Index": "1",
 "Value": "true",
 "Grouping": "AND",  
 "Condition": "eq",
 "Validation": "true"
},
{
 "Type": "EventTrigger",
 "ID": "1",
 "EventType": "AlmondModeUpdated",
 "value": "home",
 "Grouping": "AND",
 "Condition": "eq"
}
],
 "Results": [ 
{
 "Type": "DeviceResult",
 "ID": "2",
 "Index": "1",
 "Value": "true",
 "PreDelay": "10"
},
{
 "Type": "EventResult",
 "ID": "1", 
 "EventType": "AlmondModeUpdated",
 "Value": "away", 
 "PreDelay": "0" 
}
]
}

Response

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


Updaterule

Command to update an existing rule.
Request

{
 "MobileInternalIndex": "111",
 "CommandType": "UpdateRule",
 "Name": "UPATERULE",
 "Valid":"true",
 "ID": "1",
 "Triggers": [
{ 
 "Type": "DeviceTrigger",
 "ID": "1",
 "Index": "1",
 "Value": "true",
 "Grouping": "AND",
 "Condition": "eq"
},
{
 "Type": "EventTrigger",
 "ID": "1",
 "EventType": "AlmondModeUpdated",
 "Value": "home",
 "Grouping": "AND",
 "Condition": "eq"
}
],
"Results": [
{
 "Type": "DeviceResult",
 "ID": "2",
 "Index": "1",
 "Value": "true",
 "PreDelay": "10"
},
{
 "Type": "EventResult",
 "ID": "1",
 "EventType": "AlmondModeUpdated",
 "Value": "away",
 "PreDelay": "10"
}
]
}


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

{  
 "MobileInternalIndex":"<random key>",
 "CommandType":"ClientList",
 "Success":"true",
 "Clients":[  
   {  
     "ID":"1",
     "Name":"iphone_4s",
     "Connection":"wireless",
     "MAC":"other",
     "Type":"other",
     "LastKnownIP":"10.2.2.11",
     "Active":"false",
     "UseAsPresence":"true",
     "LastActiveEpoch":"1433920922",
      "Wait":"6"
   },
   {  
     "ID":"2",
     "Name":"buildserver.lan",
     "Connection":"wired",
     "MAC":"d8:50:e6:54:1b:9c",
     "Type":"other",
     "LastKnownIP":"10.10.10.1",
     "Active":"true",
     "UseAsPresence":"false",
     "LastActiveEpoch":"1433920922",
      "Wait":"6"
   }
 ]
}

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

{  
 "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
Success

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

Faliure

{
 "CommandType":"UpdateClient",
 "MobileInternalIndex":"324",
 "Success":"false",
 "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",
 "ReasonCode":"0" 
}

Failure

{
 "CommandType":"RemoveClient",
 "MobileInternalIndex":"324",
 "Success":"false",
 "ReasonCode":"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

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

Response
Note: Active :- Indicates the state of Scene

{  
 "MobileInternalIndex":"<random key>",
 "CommandType":"DynamicSceneList",
 "Scenes":[  
   {  
     "ID":"1",
     "Name":"Scene1",
      "LastActiveEpoch":"1433740885",
      "Active":"false",
     "SceneEntryList":[  
       {  
         "DeviceID":"2",
         "Index":"2",
         "Value":"true",
         "Valid":"false"
       },
       {  
         "DeviceID":"1",
         "Index":"2",
         "Value":"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

Command to add a new Scene.
Request

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

Response

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

UpdateScene

Command to update an existing Scene
Request

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

Response

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

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

SensorUpdate

When any index value 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":"DeviceAdded","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":"DeviceAdded","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"}}}}}

DeviceRemoved

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

When all the devices are removed the following update will be received.

{"commandtype":"DeviceRemoveAll"}

DeviceUpdated

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"}}}}}

DynamicRuleAdded

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

{
 "CommandType": "DynamicRuleAdded",
 "Rules": {
 "ID": "1",
 "Name": "NewRule",
 "Valid": "1",
 "Triggers": [{
 "Type": "EventTrigger",
 "EventType": "AlmondModeUpdated",
 "ID": "1",
 "Grouping": "AND",
 "Condition": "eq",
 "Validation": "true",
 "Value": "home"
 }, {
 "Type": "DeviceTrigger",
 "ID": "2",
 "Index": "1",
 "Grouping": "AND",
 "Validation": "true",
 "Condition": "eq",
 "Value": "false"
}],
 "Results": [{
 "Type": "DeviceResult",
 "ID": "2",
 "Index": "1",
 "PreDelay": "0",
 "Validation": "true",
 "Value": "false"
}, {
 "Type": "EventResult",
 "EventType": "AlmondModeUpdated",
 "ID": "1",
 "PreDelay": "0",
 "Validation": "true",
 "Value": "away"
}]
}
}


DynamicRuleUpdated

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

{
 "CommandType": "DynamicRuleUpdated",
 "Rules": {
 "ID": "1",
 "Name": "123",
 "Valid": "1",
 "Triggers": [{
 "Type": "EventTrigger",
 "EventType": "AlmondModeUpdated",
 "ID": "1",
 "Grouping": "AND",
 "Condition": "eq",
 "Validation": "true",
 "Value": "home"
}, {
 "Type": "DeviceTrigger",
 "ID": "2",
 "Index": "1",
 "Grouping": "AND",
 "Validation": "true",
 "Condition": "eq",
 "Value": "false"
}],
 "Results": [{
 "Type": "DeviceResult",
 "ID": "2",
 "Index": "1",
 "PreDelay": "0",
 "Validation": "true",
 "Value": "false"
}, {
 "Type": "EventResult",
 "EventType": "AlmondModeUpdated",
 "ID": "1",
 "PreDelay": "0",
 "Validation": "true",
 "Value": "away"
}]
}
}


DynamicRuleRemoved

When a rule is removed the following update is received.

{
 "CommandType":"DynamicRuleRemoved","Rules":{"ID":"1"}
}


DynamicAllRulesRemoved

When all rules are removed the following update is received.

{
 "CommandType":"DynamicAllRulesRemoved"
}


AlmondModeUpdated

{"commandtype":"AlmondModeUpdated","data":{"<almond mode >":{"emailid":"<email id>"}}}

Example

{"commandtype":"AlmondModeUpdated","data":{"2":{"emailid":"swetha.reddy@securifi.com"}}}

DynamicClientAdded

When a new client is added this update is received.

{  
 "CommandType":"DynamicClientAdded",
 "Clients":{  
   "ID":"1",
   "Name":"my phone",
   "Connection":"wired",
   "MAC":"c4:43:6d:c9:ef:05",
   "Type":"tv",
   "LastKnownIP":"10.10.10.55",
   "Active":"false",
   "UseAsPresence":"true",
    "Wait":"6"
 }
}

DynamicClientJoined

When a client joined network this update is received.

{  
 "CommandType":"DynamicClientJoined",
 "Clients":{  
   "ID":"1",
   "Name":"my phone",
   "Connection":"wired",
   "MAC":"c4:43:6d:c9:ef:05",
   "Type":"tv",
   "LastKnownIP":"10.10.10.55",
   "Active":"false",
   "UseAsPresence":"true",
    "Wait":"6"
 }
} 


DynamicClientLeft

When a client leaves the network, following update is received.

{  
 "CommandType":"DynamicClientLeft",
 "Clients":{  
   "ID":"1",
   "Name":"my phone",
   "Connection":"wired",
   "MAC":"c4:43:6d:c9:ef:05",
   "Type":"tv",
   "LastKnownIP":"10.10.10.55",
   "Active":"false",
   "UseAsPresence":"true",
    "Wait":"6"
 }
}

DynamicClientUpdated

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

{  
 "CommandType":"DynamicClientUpdated",
 "Clients":{  
   "ID":"1",
   "Name":"my phone",
   "Connection":"wired",
   "MAC":"c4:43:6d:c9:ef:05",
   "Type":"tv",
   "LastKnownIP":"10.10.10.55",
   "Active":"false",
   "UseAsPresence":"true",
    "Wait":"6"
 }
}

DynamicClientRemoved

When a client is removed this update is received

{"CommandType":"DynamicClientRemoved","ID":"1","MAC":"c4:43:6d:c9:ef:05"}

DynamicAllClientsRemoved

When all the clients are removed this update is received

{"CommandType":"DynamicAllClientsRemoved"}

DynamicSceneAdded

when a new scene is added this update is received.
{  
 "CommandType":"DynamicSceneAdded",
 "Scenes":{  
   "ID":"1",
   "Name":"My_created_scene",
   "LastActiveEpoch":"8295685751190847488",
   "Active":"false",
   "SceneEntryList":[  
    {"DeviceID":"1","Index":"1","Value":"false","Valid":"true"},
    {"DeviceID":"1","Index":"2","Value":"false","Valid":"false"}
    ]
 }
}

DynamicSceneUpdated

when any changes are made to existing scene this update is received.

{  
 "CommandType":"DynamicSceneUpdated",
 "Scenes":{  
   "ID":"1",
   "Name":"My_created_scene",
   "LastActiveEpoch":"8295685751190847488",
   "Active":"false",
   "SceneEntryList":[  
     {"DeviceID":"2","Index":"1","Value":"false","Valid":"true"},
     {"DeviceID":"4","Index":"1","Value":"78","Valid":"false"}
    ]
 }
}

DynamicSceneActivated

when any scene is activated this update is received.

{  
 "CommandType":"DynamicSceneActivated",
 "Scenes":{  
   "ID":"1",
   "LastActiveEpoch":"8295685751190847488",
   "Active":"true",
}  }

DynamicSceneRemoved

when any scene is removed this update is received.

{  
 "CommandType":"DynamicSceneRemoved",
 "Scenes":{  
   "ID":"1"
 }
}

DynamicAllScenesRemoved

when all scenes are removed this update is received.

{"CommandType":"DynamicAllScenesRemoved"}