[ https://jira.fiware.org/browse/HELP-13269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fernando Lopez reassigned HELP-13269: ------------------------------------- Assignee: Jose Gato Luis > [fiware-stackoverflow] iotagent-json using MQTT not publishing anything when command is sent > -------------------------------------------------------------------------------------------- > > Key: HELP-13269 > URL: https://jira.fiware.org/browse/HELP-13269 > Project: Help-Desk > Issue Type: Monitor > Components: FIWARE-TECH-HELP > Reporter: Backlog Manager > Assignee: Jose Gato Luis > Labels: fiware, fiware-orion, iot, mosquitto, mqtt > > Created question in FIWARE Q/A platform on 21-12-2017 at 17:12 > {color: red}Please, ANSWER this question AT{color} 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": [ > { "name": "ping", "type": "command", "value": ""} > ], > "attributes": [ > { "object_id": "title", "name": "title", "type": "Text" }, > { "object_id": "percentage", "name": "percentage", "type": "Text" } > ], > "static_attributes": [ { "name": "att_name", "type": "string", "value": "value" } ] } > ] > }' > 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": [ > {"name": "ping", "type": "command", "value": "ALIVE" } > ] > } > ]}' > 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. -- This message was sent by Atlassian JIRA (v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy