For your IoT projects with AskSensors, a good practice is to send a test data using a desktop to your AskSensors modules before programming your hardware. We recommend this test to be sure that your AskSensors modules setup works well. These simple actions can save you a lot of time and energy for the rest of your project.
Sending a test data over http/https to an AskSensors sensor module using desktop is so easy, just type in the address bar of your favorite browser the following url :
https://api.asksensors.com/write/apiKeyIn?module1=value1 with the right parameters. See the AskSensors HTTP/HTTPS Write/Read API post for more information.
To do the same test over mqtt, we need to install some third-party application. In this tutorial we will use the MQTTLens Chrome extension.
After installing and launching the application, click on the “+” button to add a new connection.
Now you can fill the form with the information as in the following picture. The “Username” is your AskSensors username, and for the “Password” you can type the password you want. When you are finished, click on the “CREATE CONNECTION” button.
Now that the connection is succefuly established to the AskSensors MQTT broker, we will send (Publish) data to the module 1. The AskSensors publish topic is structured in this way “publish/username/apiKeyIn” , the username is your AskSensors username and the apiKeyIn is the sensor Api Key In generated by AskSensors during the creation of your sensor.
The message payload structure is : “m1=value1&m2=value2…m6=value6”. For this example, we will publish 26 to the module 1, so the message payload will be “m1=26”.
After clicking on the “PUBLISH” button, as you see the value 26 have been plotted on the module 1.
To receive (subscribe) data from an AskSensors actuator module, you can use the following structure “actuator/username/apiKeyOut” and click on the “SUBSCRIBE” button.
Each time you change the stat of the module (ON/OFF), you will see immediately a new subscription topic on the MQTT Lens extension.
Now you are sure that your sensors/actuators modules setup works fine over mqtt. And you can begin programming your hardware quietly.
Take a look at the AskSensors tutorial section for more guides to get familiar with our platform.