Search code examples
fiwareiot

FIWARE-IoT Agent: send command to device via MQTT


I am using the FIWARE IoT agent [1] to communicate with my devices using MQTT protocol, I create a command to be able to update my device value, Here is my request to create a device:

curl -X POST http://193.48.247.247:80/iot/devices \
-i \
-H "Content-Type: application/json" \
-H "Fiware-Service: egmsmartcity" \
-H "Fiware-ServicePath: /egmsmartcitypath" \
-d ' { "devices": [ { "device_id": "streetlight1",
 "entity_name": "sensors:streetlight1",
 "entity_type": "sensors",
"protocol": "PDI-IoTA-MQTT-UltraLight",
 "timezone": "Europe/Paris",
 "endpoint": "notUsed",
 "commands": [{ "name": "streetlight1", "type": "command", "value": ""}]  } ] }'

Since I am using MQTT, the filed endpoint is not used on my case but if I delete it the MQTT does not notify my device. This request is working but is it the correct way to create a device to be able to send a command to my device via MQTT?

Thanks in advance for your help!

[1]https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus


Solution

  • This field ("endpoint": "notUsed") comes from a previous functionality that is no longer implemented (it did not make sense in MQTT). Thus since recent versions onwards it is ignored and can be deleted. Perhaps you are using a previous version of the IoT Agent and this is why it is mandatory although not functional.

    Thanks for using IDAS!