Search code examples
mqttiotmosquittowatson-iot

Using Mosquitto to experiment with the Watson Iot platform service


I have successfully connected a device and an application to the Watson IoT platform over MQTT protocal, the application subscribe the event published by device. example:http://iotf.readthedocs.io/en/latest/getting_started/quickstart/index.html

then I tried to let the device subscrbe a command published by the application.

device:

mosquitto_sub -h 184.172.124.189 -p 1883 -i "d:quickstart:devicetype:deviceid" -t iot-2/cmd/cid/fmt/json

application:

mosquitto_pub -h 184.172.124.189 -p 1883 -i "a:quickstart:applicationid" -t iot-2/type/devicetype/id/deviceid/cmd/cid/fmt/json -m  " {\"d\" : {\"temp\" : 36 }}"

the device can't receive the message published by application. what does the command include and how doed it work ?


Solution

  • Quickstart (which is completely unauthenticated, was intended to do what it says on the tin) doesn't include the ability to send commands to devices. You will have to create a device type and register a device, then something like this could work.

    When you do this, in the strings you use to authenticate e.g. quickstart will be replaced by your organization id, devicetype and deviceid by the names you use for the device type and the device name.