4

I need to modify a registered device in IoTAgent UltraLight. With modify I mean add some attributes and delete others.

I also want to update the entity in Orion CB.

Is it possible to do that? How can I do that?

gobaldia
  • 420
  • 4
  • 13

1 Answers1

0

IoTAs (and the IoTA library in general), expose a north provisioning interface for device creation. The core idea is when you provision a device in the IoTA (directly, or through the IoTA Manager), an entity is automatically created in Context Broker. Such nothr provisioning interface allows for retrieval, removal and update, too.

Being said that, the south interface of the IoTAs is designed to only accept measures and command execution results from the devices. Thus, if a new attribute comes into play, and you provide values for that new attribute via an IoTA, a new attribute will not be appended at Context Broker; simply, this information will be droped.

In order to accept data regarding new attributes, first you'll have to use the above mentioned provisioning interface of the IoTAs, in particular the update device operation, in order to provision such new attribute; that will automatically append a new attribute to the entity at Context Broker level. From here on, values for the new attribute sent to the IoTA will be updated in Context Broker.

Such an update request looks like:

PUT http://iota_host:iota_port/iot/devices/<dev_id>?protocol=<protocol_type>
Fiware-Service: <service>
Fiware-ServicePath: <subservice>

{
   "entity_type": <entity_type>,
   "attributes": [ <new_active_attrs_if_any> ],
   "lazy": [ <new_lazy_attrs_if_any> ],
   "commands": [ <new_commands_if_any> ],
   "statis_attributes": [ <new_static_attrs_if_any> ]
}

Sadly, already existent attributes cannot be removed, for the time being.

frb
  • 3,738
  • 2
  • 21
  • 51
  • H'i @frb, I'm having same challenge here, tried your suggestion but failed with error: ` $curl -X PUT \ http://localhost:4041/iot/devices/raspiSensorTV?protocol=lwm2m1.0 \ -H 'Content-Type: application/json' \ -H 'fiware-service: smartGondor' \ -H 'fiware-servicepath: /gardens' \ -d '{ "type": "Device", "attributes": [{ "name": "Temperature", "type": "Float" }, { "name": "Humidity", "type": "Float" } ] }' ` Response: ` {"name":"WRONG_SYNTAX","message":"Wrong syntax in request: Errors found validating request."} ` – arilwan Dec 17 '18 at 16:43