[英]Setting up LWM2M device communicates with IDAS
I am new to Fiware and need help.我是 Fiware 的新手,需要帮助。
I want to configure a road side device (sensor) using CoAP protocol to the IDAS IoT agent (Lightweight M2M agent), so this device can send some data to IDAS.我想将一个使用CoAP协议的路边设备(传感器)配置到IDAS IoT代理(轻量级M2M代理),这样这个设备就可以向IDAS发送一些数据。
How can I accomplish this task?我怎样才能完成这个任务?
We are a company that works with LwM2M protocol through FIWARE technologies, may be our IoT FIWARE Dockerized infrastructure could help you.我们是一家通过 FIWARE 技术使用 LwM2M 协议的公司,也许我们的 IoT FIWARE Dockerized 基础设施可以帮助您。
https://gitlab.hopu.eu/software/FIWARE/fiware-docker-infrastructure https://gitlab.hopu.eu/software/FIWARE/fiware-docker-infrastructure
Reading your comments before, I understand that you want to build an scenario in order to connect your sensors to IotAgent-LWM2M.之前阅读过您的评论,我了解到您想要构建一个场景,以便将您的传感器连接到 IotAgent-LWM2M。
I suggest you to use docker to install dependencies before comment我建议你在评论之前使用 docker 安装依赖项
version : "2"
services:
mongo:
image: mongo:3.2
command: --nojournal
ports:
- "27017:27017"
expose:
- "27017"
orion:
image: fiware/orion
links:
- mongo
ports:
- "1026:1026"
command: -dbhost mongo
expose:
- "1026"
mosquitto:
image: ansi/mosquitto
ports:
- "1883:1883"
expose:
- "1883"
Note: Mosquitto play a role like a sensor注: Mosquitto 起到传感器的作用
(curl localhost:4041/iot/devices -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' --header 'fiware-service: Factory' --header 'fiware-servicepath: /robots' \
-d @- | python -mjson.tool) <<EOF
{
"devices": [
{
"device_id": "robot1",
"entity_type": "Robot",
"attributes": [
{
"name": "Battery",
"type": "number"
}
],
"lazy": [
{
"name": "Message",
"type": "string"
}
],
"commands": [
{
"name": "Position",
"type": "location"
}
],
"internal_attributes": {
"lwm2mResourceMapping": {
"Battery" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 1
},
"Message" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 2
},
"Position" : {
"objectType": 7392,
"objectInstance": 0,
"objectResource": 3
}
}
}
}]}
EOF
curl -X POST -H "Fiware-Service: myHome" -H "Fiware-ServicePath: /environment" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
"services": [
{
"resource": "/",
"apikey": "",
"type": "Robot",
"cbroker":"localhost:1026"
}]
}' 'http://localhost:4041/iot/services'
(bin/iotagent-lwm2m-client.js)
Object Creation:
LWM2M-Client> create /7392/0
Battery attribute:
LWM2M-Client> set /7392/0 1 89
Message Attribute:
LWM2M-Client> set /7392/0 2 "First robot here"
Position attribute:
LWM2M-Client> set /7392/0 3 "[0,0]
LWM2M-Client> connect localhost 5684 robot1 /
set /7392/0 1 67
curl -X POST http://localhost:1026/v1/queryContext -s -S
--header 'Content-Type: application/json' \
--header 'Accept: application/json' --header 'fiware-service: Factory'
--header 'fiware-servicepath: /robots' \
-d '
{
"entities": [
{
"type": "Robot",
"isPattern": "false",
"id": "Robot:robot1"
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.