Closed jason-fox closed 3 weeks ago
The same issue occurs using NGSI-v2
curl -L 'http://localhost:1026/v2/entities/' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /'
4.3.0
The temperature001 device is correctly mapped to urn:ngsi-ld:Device:temperature001
.
Attribute called temperature
is present, controlledAsset
is present. ✅
{
"id": "urn:ngsi-ld:Device:temperature001",
"type": "Device",
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:40:01.074Z",
"metadata": {}
},
"category": {
"type": "Property",
"value": "sensor",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:40:01.074Z"
}
}
},
"controlledAsset": {
"type": "Relationship",
"value": "urn:ngsi-ld:Building:barn001",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:40:01.074Z"
}
}
},
"supportedProtocol": {
"type": "Property",
"value": "ul20",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:40:01.074Z"
}
}
},
"temperature": {
"type": "Property",
"value": 3,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:40:01.074Z"
},
"unitCode": {
"type": "Text",
"value": "CEL"
}
}
}
}
4.3.0
The Device configuration is ignored - the id
is taken as an anonymous device and the id
constructed.
Attribute called temperature
is incorrectly called t
, controlledAsset
is not present. ❌
{
"id": "Device:temperature001",
"type": "Device",
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:41:53.709Z",
"metadata": {}
},
"category": {
"type": "Property",
"value": "sensor",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:41:53.709Z"
}
}
},
"supportedProtocol": {
"type": "Property",
"value": "ul20",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:41:53.709Z"
}
}
},
"t": {
"type": "Text",
"value": 3,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2024-06-27T06:41:53.709Z"
}
}
}
}
IMHO no autoprovisioned devices should be provisioned with apikey, and then apikey should be provided in json:
curl -L 'http://localhost:4041/iot/devices' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-H 'Content-Type: application/json' \
-d '{
"devices": [
{
"device_id": "temperature001",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"entity_name": "urn:ngsi-ld:Device:temperature001",
"entity_type": "Device",
"timezone": "Europe/Berlin",
"attributes": [
{
"object_id": "t",
"name": "temperature",
"type": "Property",
"metadata": {
"unitCode": {
"type": "Text",
"value": "CEL"
}
}
}
],
"static_attributes": [
{
"name": "controlledAsset",
"type": "Relationship",
"value": "urn:ngsi-ld:Building:barn001"
}
]
}
]
}'
I would have no problem with doing things that way as best practice (assuming it works - I haven't tried yet). Effectively you're saying use this service
data for this apikey
+ use this device
data for this apikey
and then merge the two right?
The problem is that until 4.4.0 it was equally possible to provisions saying: _use this service
data for this entity_type
+ use this device
data for this entity_type
_ and then merge the two. So removal of this mechanism should be noted at a breaking change, and also inhibits users from upgrading to the latest image without re-creating their provisioned devices.
Furthermore, there is nothing in the iotagent-node-lib documentation to describe what is required, and looking at the IoT Agents themselves (e.g. Getting Started for ultralight) provision the service with an apikey
but do not add it to the device
.
I can confirm that adding apiKey
to the Device provisioning call does indeed work.
IoT Agent Node Lib version the issue has been seen with
4.4.0
Bound or port used (API interaction)
Northbound (Provision API and NGSI Interactions)
NGSI version
NGSI-LD and NGSI-v2
Are you running a container?
Yes, I am using a contaner (Docker, Kubernetes...)
Image type
distroless
Expected behaviour you didn't see
When provisioning attributes for a device using the API, the attribute is ignored.
Unexpected behaviour you saw
When a measure is sent, the device takes static data from the group, but the device provisioning is ignored, and the measure is sent to the context broker using auto provisioned attribute names and static attributes are ignored. This also means that linked data functionality as described in the documentation no longer works.
Steps to reproduce the problem
Using 4.4.0 library.
Provision Group with
apikey
Provision Device
temperature001
Send measure - this is using the Ultralight IoT agent
Result
Attribute called
t
present,controlledAsset
is missing. ❌Repeat with previous library:
Using 4.3.0 library the behaviour was as expected.
Provision Group with
apikey
Provision Device
temperature001
Send measure - this is using the Ultralight IoT agent
Result
Attribute called
temperature
is present,controlledAsset
is present. ✅Configs
Log output
No response