简体   繁体   English

猎户座蚊子JSON数据

[英]Orion mosquitto JSON data

I have some issues with the Orion Context Broker.我对 Orion Context Broker 有一些问题。 I am using raspberry pi to publish the JSON data to mosquitto broker that runs as a docker container.我正在使用树莓派将 JSON 数据发布到作为 docker 容器运行的蚊子代理。 I can receive the data from the publisher, and the broker should pass the data to the Orion Context Broker.我可以从发布者那里接收数据,代理应该将数据传递给 Orion 上下文代理。 I created an entity like this:我创建了一个这样的实体:

curl localhost:1026/v2/entities -s -S -H 'Content-Type: application/json' -d @- <<EOF
{
  "id": "SensTemp",
  "type": "Sensor",
  "temperature": {
     "value": 28,
     "type": "Float"
   }
 }
EOF

I can update the temperature value manually without any problems using the curl command.我可以使用 curl 命令手动更新温度值而不会出现任何问题。 The problem is that the data from my mosquitto container doesnt go to the Orion Context Broker.问题是我的蚊子容器中的数据没有 go 到 Orion Context Broker。 Here are my docker containers:这是我的 docker 容器:

version: "3.3"
services:

          mongo-db:
            image: mongo:3.6
            hostname: mongo-db
            container_name: db-mongo
            expose:
             - "27017"
            ports:
             - "27017:27017"
            networks:
             - default
            command: --bind_ip_all --smallfiles

          orion:
             image: fiware/orion
             ports:
                 - "1026:1026"
             networks:
                 - default
             depends_on:
                 - mongo-db
             command: -dbhost mongo-db -logLevel DEBUG
             healthcheck:
                   test: ["CMD", "curl", "-f", "http://0.0.0.0:1026/version"]
                   interval: 1m
                   timeout: 10s
                   retries: 3

          mqtt:
            image: eclipse-mosquitto:latest
            container_name: mqtt
            ports:
              - "1883:1883"
              - "9001:9001"
            expose:
              - "1883"
              - "9001"
            volumes:
              - /opt/mosquitto/var/run:/var/run

Here is the proof of received data from my raspberry pi publisher:这是我的树莓派发布者收到的数据的证明:

电线sharkproofmqtt到达

How can I set up the Orion to get the data from my mosquitto container?如何设置 Orion 以从我的 mosquitto 容器中获取数据?

When yo create the device, Did you indicate the transport?当您创建设备时,您是否指示了传输?

For example例如

 "device_id":   "streetLight001",
 "entity_name": "urn:ngsi-ld:StreetLight:001",
 "entity_type": "StreetLight",
 "protocol":    "PDI-IoTA-UltraLight",
 "transport":   "MQTT",
 "timezone":    "America/Bogota",

When yo create the device, Did you indicate the transport and attributes (see this image)?当您创建设备时,您是否指明了传输和属性(请参见此图)? entity creation with atributes使用属性创建实体

Update!更新! I was able to connect to the agent, the message is arriving from the mosquitto container.我能够连接到代理,消息来自 mosquitto 容器。 I only needed to create a service group and i had to create a registration using some REST orders (curl commands).我只需要创建一个服务组,我必须使用一些 REST 命令(curl 命令)创建一个注册。 but now it gives me the error of some kind, yes i know that nobody here likes screenshots but if you know how can i fix the problem thanks !!!!但现在它给了我某种错误,是的,我知道这里没有人喜欢截图,但如果你知道我该如何解决这个问题,谢谢!!!! AgentJSONOrion

Problem Solved, The problem was in the Agent.问题已解决,问题出在代理中。 i was using Ultralight IOT agent instead of the JSON Agent我使用的是 Ultralight IOT 代理而不是 JSON 代理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM