[ https://jira.fiware.org/browse/HELP-16127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fernando Lopez updated HELP-16127: ---------------------------------- Status: In Progress (was: Open) > [fiware-stackoverflow] Sending commands to devices in FIWARE Orion is not working > --------------------------------------------------------------------------------- > > Key: HELP-16127 > URL: https://jira.fiware.org/browse/HELP-16127 > Project: Help-Desk > Issue Type: Monitor > Components: FIWARE-TECH-HELP > Reporter: Backlog Manager > Assignee: Fermín Galán > Labels: fiware, fiware-orion > > Created question in FIWARE Q/A platform on 29-08-2019 at 15:08 > {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/57711025/sending-commands-to-devices-in-fiware-orion-is-not-working > +Question:+ > Sending commands to devices in FIWARE Orion is not working > +Description:+ > I am trying to provide a device on FIWARE and send commands. In my case, a lamp with commands ("on" and "off"). But, it's not working. > The steps to create a device and send command are: > Provide a device; > Create a service group; > Create a registration with commands; > Send a command. > I'm taking the fiware-tutorials following the steps, but don't work. > The code I have used was: > To create a device: > curl -iX POST \ > 'http://localhost:4041/iot/devices' \ > -H 'Content-Type: application/json' \ > -H 'fiware-service: openiot' \ > -H 'fiware-servicepath: /' \ > -d '{ > "devices": [ > { > "device_id": "lamp1", > "entity_name": "urn:ngsi-ld:Lamp:1", > "entity_type": "Lamp", > "protocol": "PDI-IoTA-UltraLight", > "transport": "HTTP", > "endpoint": "http://iot-sensors:3001/iot/lamp1", > "commands": [ > {"name": "on","type": "command"}, > {"name": "off","type": "command"} > ], > "attributes": [ > {"object_id": "s", "name": "state", "type":"Text"}, > {"object_id": "l", "name": "luminosity", "type":"Integer"} > ], > "static_attributes": [ > {"name":"refStore", "type": "Relationship","value": "urn:ngsi-ld:Store:001"} > ] > } > ] > } > ' > To create a service group: > curl -iX POST \ > 'http://localhost:4041/iot/services' \ > -H 'Content-Type: application/json' \ > -H 'fiware-service: openiot' \ > -H 'fiware-servicepath: /' \ > -d '{ > "services": [ > { > "apikey": "4jggokgpepnvsb2uv4s40d59ov", > "cbroker": "http://orion:1026", > "entity_type": "Thing", > "resource": "/iot/d" > } > ] > }' > To create a registration for commands: > curl -iX POST \ > 'http://localhost:1026/v2/registrations' \ > -H 'Content-Type: application/json' \ > -H 'fiware-service: openiot' \ > -H 'fiware-servicepath: /' \ > -d '{ > "description": "Lamp Commands", > "dataProvided": { > "entities": [ > { > "id": "urn:ngsi-ld:Lamp:1","type": "Lamp" > } > ], > "attrs": [ "on", "off" ] > }, > "provider": { > "http": {"url": "http://orion:1026/v2"}, > "legacyForwarding": true > } > }' > To send a "on" command: > curl -iX PATCH \ > 'http://localhost:1026/v2/entities/urn:ngsi-ld:Lamp:1/attrs' \ > -H 'Content-Type: application/json' \ > -H 'fiware-service: openiot' \ > -H 'fiware-servicepath: /' \ > -d '{ > "on": { > "type" : "command", > "value" : "" > } > }' > Doing a HTTP get request to retrieve the entity: > curl -G -X GET \ > 'http://localhost:1026/v2/entities/urn:ngsi-ld:Lamp:1' \ > -d 'type=Lamp' \ > -d 'options=keyValues' \ > -H 'fiware-service: openiot' \ > -H 'fiware-servicepath: /' > I expect a output like: > { > "id": "urn:ngsi-ld:Lamp:001", > "type": "Lamp", > "TimeInstant": "2019-08-28T13:33:51.00Z", > "luminosity": "1115", > "off_info": " ", > "off_status": "UNKNOWN", > "on_info": " on OK", > "on_status": "OK", > "refStore": "urn:ngsi-ld:Store:001", > "state": "ON", > "on": "", > "off": "" > } > but I receive this: > { > "id": "urn:ngsi-ld:Lamp:1", > "type": "Lamp", > "TimeInstant": "2019-08-28T12:50:22.00Z", > "luminosity": " ", > "off_info": " ", > "off_status": "UNKNOWN", > "on_info": "There was an error in the response of a device to a command [404]: on NOT OK", > "on_status": "ERROR", > "refStore": "urn:ngsi-ld:Store:001", > "state": " ", > "on": "", > "off": "" > } -- 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