Add to favorites

#Product Trends

King Pigeon MQTT protocol device connect to IOT cloud

MQTT device to IOT cloud

King Pigeon device with MQTT protocol,can connect to customer cloud server

1.King Pigeon device How to connect MQTT server?

Net work settings :

Select MQTT protocol ,fill in IP /port number,fill in Subscribe Topic/publish topic/MQTT client ID/User name/password

2. How does customer server parse MQTT?

After connecting to the customer’s MQTT server, the protocol content needs to be parsed. There are two ways.

1. King Pigeon modify the data in the MQTT json format of our device according to the payload json format in the customer's MQTT protocol. It takes about 2-3 weeks.

2.Customer modifies his server MQTT protocol according to the json format data of our device.

Note: A server can support several json content formats of MQTT protocol at the same time.

3. The json format of King Pigeon device?

In device manual , there are json format description of King Pigeon device. (Device IO and slave mapping register data,Refer to the IO/register flag of each product in the manual )pls find it in manual.

Payload content is json data format

{

"sensorDatas":

[

{

"addTime":"2015-01-01 12:00:00", //Data publish time

"value":"10.0", //Data type and value

"flag":"AIN1" //flag

},

{

"addTime":"2015-01-01 12:00:00",

"lat":39.9,

"lng":116.3,

"flag":""

},

{

"addTime":"2015-01-01 12:00:00",

"switcher":"1",

"flag":"DI1"

},

{

"addTime":"2015-01-01 12:00:00",

"str":"1",

"flag":"REG20014"

}

]

}

2)Topic Publish Format

Topic:MQTT Device ID

Payload content is json data format

{

"sensorDatas":

[

{

"value":"10.0", //Data type and value

"flag":"AIN1" //Flag

},

{

"lat":39.9,

"lng":116.3,

"flag":""

},

{

"switcher":"1",

"flag":"DI1"

},

{

"str":"1",

"flag":"REG20014"

}

]

}

Note:

Each I/O point must contain three types of information when the device publish message: add Time, data

type and value, read and write flag;

/ / Data type and value: according to the type is divided into the following

1. The numeric character is "value" followed by: "data value"

2. The positioning character is "lat" (longitude) followed by: "longitude value"

           "lng" (latitude) is followed by: "latitude value"

3. The switch character is "switcher" followed by: "data value"

4. The string character is "str" followed by: "data value"

/ / Flag: the character is "flag" followed by " flag"

    

For example KingPigeon Cloud 2.0 , after the user subscribes to the device, each I/O port has a fixed flag when the device issues a message. After the flag is filled in, can read and write the value. The I/O port flag of the device on the cloud platform is default and no need to be processed.Each I/O port has a fixed flag when the device publish a message. The specific flags are as follows:

Device own I/O Port

1)Digital input: The flag is "DIx" (x range is 0~7), indicating DIN0~7.

2)Digital output: The flag is "DOx" (x range is 0~3), indicating DIN0~3.

3)Analog input: The flag is "AIx" (x range is 0~5), indicating DIN0~5,The data type is 16bit,the actual value is 2 decimal places, platform has been mapped.

4)Temperature: The flag is "TEMP" and the data type is 16-bit type. The actual value is 2 decimal places, platform has been mapped.

Humidity: The flag is "HUMI" and the data type is 16-bit type. The actual value is 2 decimal places, platform has been mapped.

5)Pulse count: The flag is "COUNT", numeric.

6)Power supply voltage: The flag is "EXTPWR" and the data type is 16-bit type. The actual value is 2 decimal places and the platform has been mapped.

Extend I/O port/mapping register

The flag of the extend I/O port is unified to "REGx" (x is the register address). For details of the flag, reference to ["Slave Mapping Register Address”].

2. User topic subscription

  1) Subscribe to the device

After the device publish the message on the broker, client can monitor the device through the subscription.

Subscription format: serial number / + (subscription topic needs to add the wildcard "/+" after

the serial number)

2) Delivery format of device control

{

"sensorDatas":

[

{

"sensorsId": "211267", //cloud platform sensor ID

"value": "225", //switch type data, 0 is off, 1 is closed

"flag":"REG20116" // flag

}

],

"down": "down" // platform downlink message

}

Note:

The data sent by the device control must contain three types of information: sensor ID, data type,flag, and downlink message packet.

//Sensor ID: The character is "sensorsID", and the ID is automatically generated according to the platform definition.

/ / Data type and value: according to the type is divided into the following

1. The numeric character is "value" followed by: "data value"

2. The switch character is "switcher" followed by: "data value"

3. The string character is "str" ​​followed by: "data value"

/ / Flag: the character is "flag" followed by "flag"

// Platform downlink message: Confirm data is sent.

Details

  • Bao'an District, Shenzhen, Guangdong Province, China
  • king pigeon communication Co.,Ltd

    Keywords