Comments (7)
I'm not able of reproduce it, I'm obtaining an NGSIv2 update to v2/entities/expression007/attrs?type=MySensorGroup2
from iotagent-node-lib.
Hi @mrutid and @AlvaroVega
, I'm also investigating this issue.
But I'm getting the NSGI update as ""url": "http://localhost:1026/v2/entities/LivingRoomSensor/attrs?type=Device","
The steps, I'm following are:
- Provisioning A Service Group
curl -iX POST \
'http://localhost:4041/iot/services' \
-H 'Content-Type: application/json' \
-H 'fiware-service: smartgondor' \
-H 'fiware-servicepath: /gardens' \
-d '{
"services": [
{
"apikey": "1234",
"cbroker": "http://orion:1026",
"entity_type": "Device",
"resource": "/iot/d",
"entityNameExp": "'LivingRoomSensor' + motion001"
}
]
}'
- Provisioning An Individual Device
curl -iX POST -H "Fiware-Service: samrtgondor" -H "Fiware-ServicePath: /gardens" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
"devices": [
{
"device_id": "motion001",
"entity_name": "LivingRoomSensor",
"entity_type": "Device",
"attributes": [
{ "object_id": "t", "name": "Temperature", "type": "celsius" },
{ "object_id": "l", "name": "Luminosity", "type": "lumens" }
]
}
]
}
' 'http://localhost:4041/iot/devices'
- Sending Measures With The Device
mosquitto_pub -t /1234/motion001/attrs -m '{"l":4,"t": "31.5"}'
Could you please let me know the steps to reproduce the expected NGSI-v2 link? PFA.
from iotagent-node-lib.
Maybe related: PR #1284
from iotagent-node-lib.
Test performed:
Deployment
iot-agent:
image: telefonicaiot/iotagent-json:latest
hostname: iot-agent
container_name: iot-agent
depends_on:
- mongo-db1
expose:
- "${IOTA_NORTH_PORT}"
- "${IOTA_SOUTH_PORT}"
ports:
- "${IOTA_NORTH_PORT}:${IOTA_NORTH_PORT}"
- "${IOTA_SOUTH_PORT}:${IOTA_SOUTH_PORT}"
environment:
- IOTA_LOG_LEVEL=DEBUG
- IOTA_MONGO_HOST=mongo-db1
- IOTA_MONGO_PORT=${MONGO_DB_PORT}
- IOTA_MONGO_DB=iotagentjson
- IOTA_DEFAULT_RESOURCE=/iot/json
- IOTA_CB_NGSI_VERSION=v2
- IOTA_APPEND_MODE=false
Service creation
curl -iX POST 'http://localhost:4041/iot/services' \
-H 'fiware-service: service' \
-H 'fiware-servicepath: /' \
-H 'Content-Type: application/json' \
--data-raw '{
"services": [
{
"apikey": "service1",
"cbHost": "http://orion:1026",
"entity_type": "Device-1",
"resource": "/iot/json",
"expressionLanguage" : "jexl",
"entityNameExp": "'EntityNameByExp'",
"attributes": [
{
"object_id": "t",
"name": "status",
"type": "Property"
}
]
}
]
}'
Result - Orion
[
{
"TimeInstant": {
"metadata": {},
"type": "DateTime",
"value": "2022-11-30T15:20:15.145Z"
},
"id": "Device-1:dev1",
"status": {
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2022-11-30T15:20:15.145Z"
}
},
"type": "Property",
"value": 5
},
"type": "Device-1"
}
]
Conclusion
It seems entityNameExp is not working since the entity name is the default one (entityType:device_id). The expected ones is EntityNameByExp
. It is "entityNameExp": "'EntityNameByExp'",
well defined?
PD: "entityNameExp": "EntityNameByExp",
(without the single quotes) does not work too, same result.
After review in detail this issue, it was working properly (there was an error with curl bash quotes)
from iotagent-node-lib.
@MayankSingh-NEC taking into account the positive report from @mapedraza I'd suggest you to do exactly the same steps and validate, please?
from iotagent-node-lib.
Hi @fgalan, based on your suggestion, I've perform and validate the same.
Below are the steps and results:
# IoT-Agent is configured for the JSON Protocol
iot-agent:
image: fiware/iotagent-json:${JSON_VERSION}
hostname: iot-agent
container_name: fiware-iot-agent
depends_on:
- mongo-db
networks:
- default
expose:
- "${IOTA_NORTH_PORT}"
- "${IOTA_SOUTH_PORT}"
ports:
- "${IOTA_NORTH_PORT}:${IOTA_NORTH_PORT}" # localhost:4041
- "${IOTA_SOUTH_PORT}:${IOTA_SOUTH_PORT}" # localhost:7896
environment:
- IOTA_CB_HOST=orion # name of the context broker to update context
- IOTA_CB_PORT=${ORION_PORT} # port the context broker listens on to update context
- IOTA_NORTH_PORT=${IOTA_NORTH_PORT}
- IOTA_REGISTRY_TYPE=mongodb #Whether to hold IoT device info in memory or in a database
- IOTA_LOG_LEVEL=DEBUG # The log level of the IoT Agent
- IOTA_DEFAULT_EXPRESSION_LANGUAGE=jexl
- IOTA_TIMESTAMP=true # Supply timestamp information with each measurement
- IOTA_CB_NGSI_VERSION=v2 # use NGSIv2 when sending updates for active attributes
- IOTA_AUTOCAST=true # Ensure Ultralight number values are read as numbers not strings
- IOTA_APPEND_MODE=false
- IOTA_MONGO_HOST=mongo-db # The host name of MongoDB
- IOTA_MONGO_PORT=${MONGO_DB_PORT} # The port mongoDB is listening on
- IOTA_MONGO_DB=iotagentjson # The name of the database used in mongoDB
- IOTA_HTTP_PORT=${IOTA_SOUTH_PORT} # The port used for device traffic over HTTP
- IOTA_PROVIDER_URL=http://iot-agent:${IOTA_NORTH_PORT}
- IOTA_DEFAULT_RESOURCE=/iot/json
healthcheck:
interval: 5s
{"status":{
"type":"Property","value":"5",
"metadata":{
"TimeInstant":{
"type":"DateTime",
"value":"2022-12-19T10:12:30.699Z"
}}},
"refStore":{"type":"Relationship","value":"urn:ngsi-ld:Device-1:001",
"metadata":{"TimeInstant":{"type":"DateTime","value":"2022-12-19T10:12:30.699Z"}}},
"TimeInstant":{"type":"DateTime","value":"2022-12-19T10:12:30.699Z"}}
from iotagent-node-lib.
I think this issue could be closed given that
- @AlvaroVega is not able to reproduce
- @mapedraza has checked it's working properly
- @MayankSingh-NEC has validated @mapedraza's report
from iotagent-node-lib.
Related Issues (20)
- allow define transport in device group HOT 1
- NGSI-LD observedAt is ignoring timezone from service or device for multivariable sensor HOT 3
- FIWARE ServicePath wildcard not working when listing devices HOT 3
- Timeinstant as attribute case (not measure) HOT 5
- No CMD attributes added when sending push commands (using `endpoint`) HOT 8
- Change type from string to Text HOT 3
- NGSI entity is missing attributes with manual device provisioning through Rest API HOT 10
- create mongodb index over Device collection HOT 3
- add new API to delete high number of devices HOT 3
- More flexible functional test (to cover northbound-only interactions)
- Remove dependency on deprecated domain module HOT 1
- active attributes are stored in Device model (mongo) as "active" but are stored in Group Model as "attributes" HOT 3
- Wrong association of measurements to the correct device using different service groups but same device_id HOT 10
- ENTITY_GENERIC_ERROR is logging so much info HOT 2
- Allow use a different TimesInstant wording for metadata HOT 3
- allow use measures with metadatas it will be constants HOT 1
- allow to define metadatas in device attributes HOT 1
- Add `timestamp` tests HOT 1
- Problems with explicitAttrs and TimeInstan #1605 HOT 4
- sort multimeasures by an attribute (by TimeInstant ) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iotagent-node-lib.