[ https://jira.fiware.org/browse/HELP-17395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fernando Lopez reassigned HELP-17395: ------------------------------------- Assignee: Jason Fox > [fiware-stackoverflow] Cannot provision an actuator in IoT Agent Fiware > ----------------------------------------------------------------------- > > Key: HELP-17395 > URL: https://jira.fiware.org/browse/HELP-17395 > Project: Help-Desk > Issue Type: Monitor > Components: FIWARE-TECH-HELP > Reporter: Backlog Manager > Assignee: Jason Fox > Labels: fiware, fiware-orion, mqtt, provisioning > > Created question in FIWARE Q/A platform on 17-02-2021 at 22:02 > {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/66250277/cannot-provision-an-actuator-in-iot-agent-fiware > +Question:+ > Cannot provision an actuator in IoT Agent Fiware > +Description:+ > I am using the following python code to create a service group > import json > import requests > url = 'http://localhost:4041/iot/services' > headers = {'Content-Type': "application/json", 'fiware-service': "openiot", 'fiware-servicepath': "/mtp"} > data = { > "services": [ > { > "apikey": "456dgffdg56465dfg", > "cbroker": "http://orion:1026", > "entity_type": "Door", > #resource attribute is left blank since HTTP communication is not being used > "resource": "" > } > ] > } > res = requests.post(url, json=data, headers=headers) > #print(res.status_code) > if res.status_code == 201: > print("Created") > elif res.status_code == 409: > print("A resource cannot be created because it already exists") > else: > print (res.raise_for_status()) > But when trying to provision an actuator I get a bad request 400 error with the code below: > import json > import requests > url = 'http://localhost:4041/iot/devices' > headers = {'Content-Type': "application/json", 'fiware-service': "openiot", 'fiware-servicepath': "/mtp"} > data = { > "devices": [ > { > "device_id": "door003", > "entity_name": "urn:ngsi-ld:Door:door003", > "entity_type": "Door", > "protocol": "PDI-IoTA-UltraLight", > "transport": "MQTT", > "commands": [ > {"name": "unlock","type": "command"}, > {"name": "open","type": "command"}, > {"name": "close","type": "command"}, > {"name": "lock","type": "command"} > ], > "attributes": [ > {"object_id": "s", "name": "state", "type":"Text"} > ] > } > ] > } > res = requests.post(url, json=data, headers=headers) > #print(res.status_code) > if res.status_code == 201: > print("Created") > elif res.status_code == 409: > print("Entity cannot be created because it already exists") > else: > print (res.raise_for_status()) > Here is the error message I get in console. > iot-agent | time=2021-02-17T11:39:44.132Z | lvl=DEBUG | corr=16f27639-49c2-4419-a926-2433805dbdb3 | trans=16f27639-49c2-4419-a926-2433805dbdb3 | op=IoTAgentNGSI.GenericMiddlewares | from=n/a | srv=smartdoor | subsrv=/mtp | msg=Error [BAD_REQUEST] handling request: Request error connecting to the Context Broker: 501 | comp=IoTAgent > iot-agent | time=2021-02-17T11:39:44.133Z | lvl=DEBUG | corr=390f5530-f537-4efa-980a-890a44153811 | trans=390f5530-f537-4efa-980a-890a44153811 | op=IoTAgentNGSI.DomainControl | from=n/a | srv=smartdoor | subsrv=/mtp | msg=response-time: 29 | comp=IoTAgent > What is strange is that if a remove the commands from the payload the device provisioning works fine. Is there something am I doing wrong while trying to provision an actuator (not a sensor)? > IoT Agent version: > {"libVersion":"2.14.0-next","port":"4041","baseRoot":"/","version":"1.15.0-next"} > Orion version: > { > "orion" : { > "version" : "2.2.0", > "uptime" : "0 d, 0 h, 59 m, 18 s", > "git_hash" : "5a46a70de9e0b809cce1a1b7295027eea0aa757f", > "compile_time" : "Thu Feb 21 10:28:42 UTC 2019", > "compiled_by" : "root", > "compiled_in" : "442fc4d225cf", > "release_date" : "Thu Feb 21 10:28:42 UTC 2019", > "doc" : "https://fiware-orion.rtfd.io/en/2.2.0/" > } > } > My docker-compose file looks as follows: > iot-agent: > image: fiware/iotagent-ul:latest > hostname: iot-agent > container_name: iot-agent > restart: unless-stopped > depends_on: > - mongo-db > networks: > - default > expose: > - "4041" > ports: > - "4041:4041" > environment: > - IOTA_CB_HOST=orion > - IOTA_CB_PORT=1026 > - IOTA_NORTH_PORT=4041 > - IOTA_REGISTRY_TYPE=mongodb > - IOTA_LOG_LEVEL=DEBUG > - IOTA_TIMESTAMP=true > - IOTA_CB_NGSI_VERSION=v2 > - IOTA_AUTOCAST=true > - IOTA_MONGO_HOST=mongo-db > - IOTA_MONGO_PORT=27017 > - IOTA_MONGO_DB=iotagentul > - IOTA_PROVIDER_URL=http://iot-agent:4041 > - IOTA_MQTT_HOST=mosquitto > - IOTA_MQTT_PORT=1883 > Thanks in advance. > Regards, -- 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