Details
-
Type:
Monitor
-
Status: Closed
-
Priority:
Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
Labels:
-
HD-Chapter:IoT
-
HD-Enabler:IDAS
Description
Created question in FIWARE Q/A platform on 21-12-2017 at 17:12
Please, ANSWER this question AT https://stackoverflow.com/questions/47928899/iotagent-json-using-mqtt-not-publishing-anything-when-command-is-sent
Question:
iotagent-json using MQTT not publishing anything when command is sent
Description:
On my server I have Orion context broker and an IoT agent working in docker containers. I can register and update my entity using MQTT protocol no problem. But I would like to be able to send command to my device using the command system in the IoT Agent. In the Documentation, it says that when a command is registered, the IoT agent publish something in /apiKey/EntityID/cmd. However, when I do so, I don't have anything published. The entity is updated properly (I can see the status of the command going to PENDING, and positive LOG telling me that everything is OK. But nothing is published on my MQTT topic.
Here is my docker-compose.yml file:
version: '3.3'
services:
iot-mongo:
image: mongo:3.2
ports:
- "27017:27017"
volumes: - ./data/mongo:/data/db
iot-agent:
image: fiware/iotagent-json
ports:
- "4041:4041"
links: - iot-mongo
- orion
- mosquitto
volumes: - ./config.js:/opt/iotajson/config.js
mosquitto:
image: toke/mosquitto
ports: - "1883:1883"
- "9001:9001"
orion:
image: fiware/orion:1.9.0
links: - iot-mongo
ports: - "1026:1026"
command: -dbhost iot-mongo
I create my entity like this :
curl -X POST http://127.23.64.163:4041/iot/devices \
-i \
-H "Content-Type: application/json" \
-H "Fiware-Service: proj" \
-H "Fiware-ServicePath: /proj" \
-d ' { "devices": [
{ "device_id": "iotsensor10", "entity_name": "iotsensor10", "entity_type": "sensorping", "timezone": "America/Santiago",
"commands": [
],
"attributes": [
,
{ "object_id": "percentage", "name": "percentage", "type": "Text" } ],
"static_attributes": [
] }
]
}'
I can update my entity with the following command:
mosquitto_pub -h 127.23.64.163 -t /1234/iotsensor10/attrs -m '
{"title": "mqtttitle", "percentage": "31.5"}'
and create a command like this :
curl --request POST http://127.23.64.163:1026/v1/updateContext \
-i \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Fiware-Service: proj" \
-H "Fiware-ServicePath: /proj" \
-d ' {"updateAction": "UPDATE", "contextElements": [
{"id": "iotsensor10", "type": "sensorping", "isPattern": "false",
"attributes": [
]
}
]}'
and I subscribe with :
mosquitto_sub -h 127.23.64.163 -t /# -v
But I see nothing coming when I create a command.
However, if I run :
mosquitto_pub -h 127.23.64.163 -t /1234/iotsensor10/cmdexe -m '
{"ping": "kebab"}'
I can validate the command and watch the result on my entity. The only problem I have is that nothing is published when the command is created when I expect something to be published on /apikey/sensor10/cmd . Any idea why and how to fix it?
Update 1
I tried to do the same manipulations with the image fiware/iotagent-ul but I have the exact same result. Nothing is published.
Activity
Transition | Time In Source Status | Execution Times | Last Executer | Last Execution Date | |||||
---|---|---|---|---|---|---|---|---|---|
|
4d 19h 17m | 1 | Backlog Manager | 17/Jan/18 3:05 PM | |||||
|
2h 59m | 1 | Backlog Manager | 17/Jan/18 6:05 PM |