Details
-
Type: Monitor
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: FIWARE-TECH-HELP
-
Labels:
-
HD-Chapter:Unknown
-
HD-Enabler:Unknown
-
HD-Node:Unknown
Description
Created question in FIWARE Q/A platform on 01-07-2024 at 17:07
Please, ANSWER this question AT https://stackoverflow.com/questions/78692944/defining-a-device-with-multiple-topics-with-fiware-iotagent
Question:
Defining a device with multiple topics with Fiware-IoTAgent
Description:
I have a sensor device. There are 2 topics under this sensor device. I want to listen to the topics and sensor attributes of this sensor device using fiware-iotagentjson. But I don't know how to send a request to fiware-iotagentjson for this device.
I use this docker-compose.yml:
version: "3.8"
services:
- Orion is the context broker
orion:
image: fiware/orion:$ {ORION_VERSION}hostname: orion
container_name: fiware-orion-pms
networks:
- default
expose: - "$
{ORION_PORT}"
ports:
- "${ORION_PORT}:$
{ORION_PORT}" # localhost:1026
command: -dbhost ${IP_ADDRESS}:27030 -logLevel DEBUG -mqttTimeout ${ORION_MQTT_TIMEOUT} -t 255
environment:
- ORION_LOG_DEPRECATE=true
healthcheck:
test: curl --fail -s http://orion:${ORION_PORT}/version || exit 1
interval: 5s
restart: always
iot-agent:
image: fiware/iotagent-json:3.3.0
hostname: iot-agent
container_name: fiware-iot-agent-pms
networks: - default
expose: - "$
{IOTA_NORTH_PORT}"
ports:
- "${IOTA_NORTH_PORT}:$
{IOTA_NORTH_PORT}" # localhost:4041
environment:
- IOTA_CB_HOST=${IP_ADDRESS} # name of the context broker to update context
- IOTA_CB_PORT=1026 # port the context broker listens on to update context
- IOTA_NORTH_PORT=4041
- 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_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_MONGO_HOST=${IP_ADDRESS} # The host name of MongoDB
- IOTA_MONGO_PORT=27030 # The port mongoDB is listening on
- IOTA_MONGO_DB=iotagentul # The name of the database used in mongoDB
- IOTA_MQTT_HOST=${MQTT_HOST} # The host name of the MQTT Broker
- IOTA_MQTT_PORT=1883 # The port the MQTT Broker is listening on to receive topics
- IOTA_DEFAULT_RESOURCE=
- IOTA_PROVIDER_URL=http://iot-agent:${IOTA_NORTH_PORT} - IOTA_DEFAULT_TRANSPORT=MQTT
healthcheck:
interval: 5s
restart: always
networks:
default:
labels:
org.fiware: 'fiware-networks-pms'
ipam:
config: - subnet: 172.50.1.0/24
If I have a device like below:
test:CD99{
ENV
Data =
}
I use the following curl for the device given above and similar and the device is registered to mongo successfully. Curl is:
curl --location 'http://192.168.2.205:4041/iot/devices' \
--header 'fiware-service: acd' \
--header 'fiware-servicepath: /pa/DEVICE31' \
--header 'Content-Type: application/json' \
--data '{
"devices": [
{
"device_id": "PA_DEVICE31",
"entity_name": "PA_DEVICE31",
"entity_type": "pa",
"transport": "HTTP",
"timezone": "Europe/Istanbul",
"attributes": [
],
"static_attributes": [
],
"explicitAttrs": true
}
]
}'
mongo data:
I currently have a device that comes in the following json structure. There are 2 topics under this device. There are sensors under every topic.
test:CD99{
ENV
Data ={
"OT_LOW_BUFF_RESET_CNT": 0,
"COAP_AA": 0,
"NRFX_AA": 28,
}
RSSI
Data={
{
"DA1C1C": "-37",
"000000": "0"
}
}
If I have a device with the above data structure, how should I prepare a curl for this device?
Activity
Field | Original Value | New Value |
---|---|---|
Component/s | FIWARE-TECH-HELP [ 10278 ] |
HD-Enabler | Unknown [ 10910 ] | |
HD-Chapter | Unknown [ 10845 ] | |
HD-Node | Unknown [ 10852 ] |