telefonicaid / iotagent-ul

IoT Agent for a UltraLight 2.0 based protocol (with HTTP, MQTT and AMQP transports)
https://fiware-iotagent-ul.rtfd.io/
GNU Affero General Public License v3.0
37 stars 55 forks source link

Error updating a command to a device self-registered by a group #612

Open JuanCarlosSecmotic opened 1 year ago

JuanCarlosSecmotic commented 1 year ago

I am trying to be able to receive a command when sending data, everything works fine when I create a device, but when the device is self-registered by a device group this command fails.

Create device group

Post -> http://localhost:4041/iot/services { "services": [ { "resource": "/iot/d", "apikey": "801230BJKL23Y9090DSFL123HJK09H324HV8732", "type": "Light", "polling": true, "attributes": [ { "object_id": "c", "name": "count", "type": "Integer" } ], "commands": [ { "name": "ring", "type": "command" } ] } ] }

I generate the device Post -> http://localhost:7896/iot/d?i=motion1&k=801230BJKL23Y9090DSFL123HJK09H324HV8732 c|3323

then I update the command through the iot Post -> http://localhost:4041/v2/op/update { "actionType": "update", "entities": [ { "type": "Light", "id": "Light:motion1", "polling": true, "ring" : { "type": "command", "value": "44423" } } ] }

it responds 204 but in orion the error has already been logged.

ring_info has this value -> There was an error in the response of a device to a command []:RequestError: Missing url property

I have been testing, the autogenerated device does not have the attribute called polling in the IoT database, if I edit it manually and add it as true, the command works

UPDATE (compose file + config + postman collection added) environment.zip

mapedraza commented 1 year ago

Please, could you provide more information?

Additionally, could you provide curl like requests for all the steps?

JuanCarlosSecmotic commented 1 year ago

thanks for answering, I have updated the issue with a zip with the necessary files to test it

mapedraza commented 1 year ago

@JuanCarlosSecmotic could you please open a PR with providing test case showing this issue failing? This would help a lot.

AlvaroVega commented 11 months ago

Testing with latests version of iotagent-ul and the following env vars

I've see that this request: Post -> http://localhost:4041/v2/op/update { "actionType": "update", "entities": [ { "type": "Light", "id": "Light:motion1", "polling": true, "ring" : { "type": "command", "value": "44423" } } ] }

should be performed over context broker, not over iotagent (http://localhost:1026/v2/op/update and providing fiware-service and fiware-servicepath). And then "polling":true should not be provided to avoid errors.