1. Home
  2. Facilio MQTT- Commands/Response Json format

Facilio MQTT- Commands/Response Json format

Important Note:

  1. In case you have more than one agent and subscribed to /msgs, all the agents will receive this command.
  2. In every command JSON which is pushed from the cloud there will be an agent key, the value will be the clientId of any one of the agents. 
  3. The agent should check whether the agent value matches with it’s clientId. If it doesn’t match, it should ignore that command. If it matches, it should start processing.

Note: We are working on newer version of API, because of that there will be changes to the below format. We will notify our users regarding the same upon changing.

Subscribed JSON:

JSON Format

{

      “agent”:”Agent_Name”, // mandatory

 “deviceId”: “the clientId”,  // mandatory – Specifies the clientId in

 “PUBLISH_TYPE”: “agent, // mandatory
“timestamp”:1567077570145,
“message”: “Subscribed to OriginalTopic/msgs” ,

“status”:2 //    //mandatory – Two indicates subscribed
}

 

 

Sample Subscribe JSON

{

“agent”:”Win-446C-249F-C1F0-945D”,

“deviceId”: “Win-446C-249F-C1F0-945D”,

“PUBLISH_TYPE”:”agent“,

“timestamp”:1575283655499,

“message”: “Subscribed to xyz/msgs”,

“status”:2

}

 

 

Ping Command:

  1. This is the command which comes from the cloud to the Agent to check whether the Agent subscription is active & connected.
  2. The “agent” attribute can be used to check whether a command is for this specific agent. If the agent is different from the current one, it can be ignored.

The “msgid” attribute is used to avoid duplicate messages pushed from the cloud for the same command in a short span of time. This msgid should be the same in the response.

Ping Command JSON Format

{

  “agent”: “Agent-Name”, // use this value for filtering the commands specific to an agent

  “msgid”: 5046, // a numeric incremental  value set by cloud for every command.

  “command”: “ping”  // name of the command
}

 

 

Sample Ping Command JSON

Ping Command Response JSON FormatPing Command Response JSON Format

Ping Command Response:

  1. This is the response JSON which need to be pushed to the cloud by the Agent in response to the Ping Command. 
  2. Always it will be good to add the additional response attributes, to the incoming command JSON and push it back to the cloud.
  3. The msgid should be the same as the one which came in the command.

Ping Command Response JSON Format

{

  “agent”: “Agent-Name”, // use the JSON attribute which came in ping command..

  “msgid”: 5046,  // use the JSON which came in ping command..

  “command”: “ping” ,  // use the JSON which came in ping command..

“timestamp”: 1575959637011, // a new response attribute – current time in millis

 “info”: “subscription active”, // a new response attribute – any valid connection msg
  “message”: “Executed”,   // a new response attribute.. Do not change this message.
“status”:1   // response attribute – one indicates connected.

}

 

Sample Ping Command Response


{

“agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

“msgid”: 5046,

“command”: “ping”,

“timestamp”: 1575959637011, // response attribute

 “info”: “subscription active”, // response attribute
  “message”: “Executed”,   // response attribute
“status”:1   // response attribute – one indicates connected.
}

 

Controller JSON:

  1. This is the JSON type which need to be pushed to the cloud after the connect JSON.
  2. This JSON can be sent once during the first time discovery/identification of the controller or if there are any change in number of points or it’s properties. 
  3. For each controller, a separate JSON should be pushed and you cannot club multiple JSON in one JSON data.
  4. This JSON data need not be pushed at regular intervals or for every restart or reconnection of the agent.
  5. PUBLISH_TYPE should be set to devicepoints//note:  all small case here

JSON Format:

 

 {

        “agent”:”Agent_Name”,  // mandatory

        “PUBLISH_TYPE”: “devicepoints”, // mandatory

        “timestamp”:1567077567195,

        “deviceName”:”Controller/SensorName-1″,  //a string by which you can uniquely
//identify the sensor or controller or device

        “type”:10,  // an integer value.. 10 – misc controller — do not change the value

        “availablePoints”: 04, // a number – which specifies the total no. of control points 

//available in this sensor or controller.

        “points”:[ ] //empty array.. can be filled in the response for discoverPoints commands

      “properties”: { 

//optional.. if you wish to add any additional property related to sensor

“key1″:”val1”,

“key2″:”val2”

    }

}

//if you wish to add more controllers, please make sure

//  to send new jsons similar to above controller details with 

// appropriate deviceName , properties and empty points array. 

 

Sample Controller JSON:

{

“agent”:”Win-446C-249F-C1F0-945D”,  // mandatory

“PUBLISH_TYPE”:”devicepoints”,// mandatory

“availablePoints”:6,

“timestamp”:1575283551406,

“type”:10, 

“deviceName”:”ECY-S1000-EF99A8″,

“points”:[]

}

 

Discover Points Command:

  1. This command will be initiated(user action) from the cloud to discover all the points available in this controller.
  2. The “agent” attribute can be used to check whether a command is for this specific agent. If the agent is different from the current one, it can be ignored.

The “msgid” attribute can be used to avoid duplicate messages pushed from the cloud for the same command in a short span of time. This msgid should be the same in the response.

{

  “agent”: “Agent_Name“, // use this value for filtering the commands specific to an agent
“msgid”: 5027, // a numeric incremental  value set by cloud for every command.

  “type”: 10,  // an integer value.. 10 – misc controller

  “deviceName”: “ECY-S1000-EF99A8”,  // specifying the controller Name for which discover points is initiated

  “command”: “discoverPoints”,  // name of the command

  “timestamp”: 1576488946569 // initiated times..

}

 

Sample Discover Points Command JSON Format:

{

  “agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “ipAddress”: “1:192.168.1.2:47808”,

  “msgid”: 5027,

  “type”: 10,

  “deviceName”: “ECY-S1000-EF99A8”,

  “command”: “discoverPoints”,

  “timestamp”: 1576488946569

}

 

Discover Points Command Response

DPC-Processing JSON

{

  “agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “PUBLISH_TYPE”: “ack”,

  “ipAddress”: “1:192.168.1.2:47808”,

  “msgid”: 5027,

  “type”: 10,

  “message”: “Processing”,

  “deviceName”: “ECY-S1000-EF99A8”,

  “command”: “discoverPoints”,

  “timestamp”: 1576488773935,

  “status”: 1  

}

 

 DPC-Response JSON

{

  “agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “PUBLISH_TYPE”: “devicepoints”,

  “ipAddress”: “1:192.168.1.2:47808”,

  “availablePoints”: 6,

  “type”: 10,

  “deviceName”: “ECY-S1000-EF99A8”,

  “points”: [

    {

      “instance”: “FAC_PHASE_VOLTAGE_R”,

      “isWritable”: true,

      “device”: “ECY-S1000-EF99A8”,

      “instanceDescription”: “Phase Voltage R”

    },

    {

      “instance”: “FAC_PHASE_VOLTAGE_B”,

      “isWritable”: true,

      “device”: “ECY-S1000-EF99A8”,

      “instanceDescription”: “Phase Voltage B”

    },

    {

      “instance”: “FAC_CH_CHILLED_WATER_RETURN_SETPOINT”,

      “isWritable”: true,

      “device”: “ECY-S1000-EF99A8”,

      “instanceDescription”: “Chiller chilled water return setpoint”

    },

    {

      “instance”: “FAC_CH_RETURN_TEMPERATURE”,

      “isWritable”: true,

      “device”: “ECY-S1000-EF99A8”,

      “instanceDescription”: “Chiller return Air Temp””

    },

    {

      “instance”: “FAC_AHU_OUTSIDE_AIR_TEMPERATURE”,

      “isWritable”: true,

      “device”: “ECY-S1000-EF99A8”,

      “instanceDescription”: “AHU outside Air Temp”

    },

    {

      “instance”: “FAC_AHU_ON_COIL_TEMPERATURE”,

      “isWritable”: true,

      “device”: “ECY-S1000-EF99A8”,

      “instanceDescription”: “AHU On coil Temp””

    }

  ],

  “timestamp”: 1576488774229

}

 

DPC-Completed JSON:

{

  “agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “PUBLISH_TYPE”: “ack”,

  “ipAddress”: “1:192.168.1.2:47808”,

  “msgid”: 5027,

  “type”: 10,

  “message”: “Executed”,

  “deviceName”: “ECY-S1000-EF99A8”,

  “deviceId”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “command”: “discoverPoints”,

  “timestamp”: 1576488774471,

  “status”: 3  //mandatory indicates Executed

}

 

Configure:

 

{

  “agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “networkNumber”: 1,

  “ipAddress”: “1:192.168.1.2:47808”,

  “msgid”: 5028,

  “instanceNumber”: 1002,

  “type”: 10,

  “deviceName”: “ECY-S1000-EF99A8”,

  “command”: “configure”,

  “portNumber”: -1,

  “broadcastAddress”: “1”,

  “points”: [

    {

      “instance”: “FAC_AHU_OUTSIDE_AIR_TEMPERATURE”,

      “pointId”: 1731641,

      “instanceType”: 2,

      “device”: “ECY-S1000-EF99A8”,

      “objectInstanceNumber”: 29,

      “instanceDescription”: “Test”

    },

    {

      “instance”: “FAC_AHU_ON_COIL_TEMPERATURE”,

      “pointId”: 1731642,

      “instanceType”: 2,

      “device”: “ECY-S1000-EF99A8”,

      “objectInstanceNumber”: 27,

      “instanceDescription”: “Test”

    }

  ],

  “macAddress”: “1002_1:192.168.1.2:47808_1”,

  “subnetPrefix”: 1,

  “timestamp”: 1576496118910

}

 

{

  “agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “networkNumber”: 1,

  “PUBLISH_TYPE”: “ack”,

  “ipAddress”: “1:192.168.1.2:47808”,

  “msgid”: 5028,

  “instanceNumber”: 1002,

  “type”: 1,

  “message”: “Processing”,

  “deviceName”: “ECY-S1000-EF99A8”,

  “deviceId”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “command”: “configure”,

  “portNumber”: -1,

  “broadcastAddress”: “1”,

  “points”: [

    {

      “instance”: “FAC_AHU_OUTSIDE_AIR_TEMPERATURE”,

      “pointId”: 1731641,

      “instanceType”: 2,

      “device”: “ECY-S1000-EF99A8”,

      “objectInstanceNumber”: 29,

      “instanceDescription”: “Test”

    },

    {

      “instance”: “FAC_AHU_ON_COIL_TEMPERATURE”,

      “pointId”: 1731642,

      “instanceType”: 2,

      “device”: “ECY-S1000-EF99A8”,

      “objectInstanceNumber”: 27,

      “instanceDescription”: “Test”

    }

  ],

  “macAddress”: “1002_1:192.168.1.2:47808_1”,

  “subnetPrefix”: 1,

  “timestamp”: 1576495946419,

  “status”: 1

}

 

{

  “agent”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “networkNumber”: 1,

  “PUBLISH_TYPE”: “ack”,

  “ipAddress”: “1:192.168.1.2:47808”,

  “msgid”: 5028,

  “instanceNumber”: 1002,

  “type”: 1,

  “message”: “Executed”,

  “deviceName”: “ECY-S1000-EF99A8”,

  “deviceId”: “Qnx-TITAN-AF1E-4D92-66E8-7A0A”,

  “command”: “configure”,

  “portNumber”: -1,

  “broadcastAddress”: “1”,

  “points”: [

    {

      “instance”: “FAC_AHU_OUTSIDE_AIR_TEMPERATURE”,

      “pointId”: 1731641,

      “instanceType”: 2,

      “device”: “ECY-S1000-EF99A8”,

      “objectInstanceNumber”: 29,

      “instanceDescription”: “Test”

    },

    {

      “instance”: “FAC_AHU_ON_COIL_TEMPERATURE”,

      “pointId”: 1731642,

      “instanceType”: 2,

      “device”: “ECY-S1000-EF99A8”,

      “objectInstanceNumber”: 27,

      “instanceDescription”: “Test”

    }

  ],

  “macAddress”: “1002_1:192.168.1.2:47808_1”,

  “subnetPrefix”: 1,

  “timestamp”: 1576495946665,

  “status”: 3

}

 

 

Was this article helpful?