Git Product home page Git Product logo

Comments (7)

AlvaroVega avatar AlvaroVega commented on August 12, 2024

I'm not able of reproduce it, I'm obtaining an NGSIv2 update to v2/entities/expression007/attrs?type=MySensorGroup2

from iotagent-node-lib.

MayankSingh-NEC avatar MayankSingh-NEC commented on August 12, 2024

Hi @mrutid and @AlvaroVega
entityNameExp
, 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:

  1. 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"
   }
 ]
}'
  1. 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'
  1. 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.

fgalan avatar fgalan commented on August 12, 2024

Maybe related: PR #1284

from iotagent-node-lib.

mapedraza avatar mapedraza commented on August 12, 2024

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.

fgalan avatar fgalan commented on August 12, 2024

@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.

MayankSingh-NEC avatar MayankSingh-NEC commented on August 12, 2024

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
  1. Service Provisioning:
    image

  2. Device Provisioning:
    image

  3. Sending Measurement:
    image

  4. Retrieving details:
    image

Result - Orion
image

{"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"}}

Result - Iot-Agent
image

from iotagent-node-lib.

fgalan avatar fgalan commented on August 12, 2024

I think this issue could be closed given that

from iotagent-node-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.