s iot Bind cloud | Switch MQTT API

MQTT is a lightweight publish/subscribe messaging protocol which probably makes it the most suitable for IoT devices Learn more about MQTT.
iotBind platform integrates with MQTT.one services to publish messages to Your devices by Your mqtt.one account.

what you need:
1. Pro iotBind Account To activate the MQTT feature
2. Registration  in MQTT.one (MQTT Service) to get and use the Broker and Topic Data

To generate a API key for device, click on the key icon After adding the device And Click on the refresh icon To generate a new key Any time.

Switch

After registration in MQTT.one, Add topics you need to use, and back to account in iotBind.com
in main menu Click on "MQTT Service"
enter you mqtt.one email and password and Click "link" button,After successful linking Then you'll see all your Broker and topic data


Now your account is ready to publish (messages) and subscribe (topic) by mqtt protocol
go to Switch page Click in "edit" icon to show the device Setting and enable the "MQTT" publish messages feature and Select the topic you want the iotBind platform to publish messages to

"You can manage your list topics from your MQTT.one account"


connect the devices with iotBind by MQTT protocol:
- Broker Domian: Same Broker Domian in your MQTT.one account
- Port: Same Port in your MQTT.one account
- User : Same User in your MQTT.one account
- Password: Same Password in your MQTT.one account
- Client ID: iotbind-XXXXXXXXX
"Important! replace XXXXXXXX with device UniqueID"

publish data from iotBind to Your devices:
iotBind paltform can use any topic has permission to publishing a message by your MQTT.one account to Your Any device that subscribe in the same topic

publish data from sensors devices or application to iotBind platform:
After link your account with MQTT.one you will see all the Topics where you can publish data to iotBind

Sending and receiving Messages format:
Text Message format: json
Parameter Value Description
uid UniqueID Device UniqueID
Always use it When you want to send an update or get data
keyEncrypted key
Device API secret key
Always use it When you want to send an update or get data
cmd One of these:
"on"
"off"
"get"
"ping"
only use one of these commands when you send message to iotbind
"on" If you want to send on Command to Device
"off" If you want to send off Command to Device
"get" If you want get all device data frome iotBind platform
"ping" If you want send ping Command to iotBind platform to learn that the device is connected
data1Text or numbers
(optional)  Use it only for update data1
data2Text or numbers
(optional)  Use it only for update data2
data3Text or numbers
(optional) Use it only for update data3

Examples:
After setup your device to contact the MQTT Broker and subscribe in the special topic your choice to receive data messages from the iotBind platform After any change in data by browser,mobile app,event,timer or update the data , For Example:
use mobile app to send the "on" request, your device get a txt json massege in the same topic devise subscribe:
{
    "uid":"UniqueID",
    "name":"DeviceName",
    "cmd":"on",
    "data1":"Anything",
    "data2":"Anything",
    "data3":"Anything"
}

if you need to send the "off" request by publish MQTT data message to iotBind platform, you need to send a txt json data message to the special iotbind/switch/ topic show in your iotBind account>MQTT Service like:
{
    "uid":"Device UniqueID",
    "key":"Device API secret key",
    "cmd":"off",
    "data1":"Anything",
    "data2":"Anything",
    "data3":"Anything"
}
* data1,data2,data3 is an optional if you need to update data

if you need to get switch data by publish MQTT message to iotBind platform, you need to send a txt json massege to the special iotbind/switch/ topic show in your iotBind account>MQTT Service like:
{
     "uid":"Device UniqueID",
     "key":"Device API secret key",
     "cmd":"get"
}
the iotBind platform publish a data message to the same topic devise subscribe

If you want send ping Command to iotBind platform to learn that the device is connected by publish MQTT message to iotBind platform, you need to send a txt json massege to the special iotbind/switch/ topic show in your iotBind account>MQTT Service like:
{
    "uid":"Device UniqueID",
    "key":"Device API secret key",
    "cmd":"ping"
}

Note: When the device is connected by MQTT protocol, the connection status will be updated directly by server

need code ?

You can download and use the code and modify it for your project

Arduino firmware

NodeMCU Board
ESP8266 module

NudeMCU firmware Lua code (soon)

NodeMCU Board
ESP8266 module