如何配置上下文代理接受来自远程传感器的 post 请求?
How do I configure context broker accept post requests from my remote sensor?
我设置了带有不同传感器的气象站。到目前为止,我的做法是将传感器数据发送到网址。但是现在我已经在服务器上设置了 CentOS 6.6 及其 IP 地址,所以现在我想将传感器数据直接发送到安装了 orion context broker 的机器。
所以我的问题是,我如何配置 orion context broker 来接受这些 post 发送到 CentOS 机器的请求(来自气象站传感器)?
向 运行 Orion Context Broker 的 CentOS 机器发送 post 请求应该没有任何问题。事实上,这是 运行 Orion 支持的 OS。
只需确保您打开了 Orion 将监听的端口(默认为 1026),并且 post 中的负载是可接受的。
例如,要发送一个值,您可以对 <host>:<port>/v1/contextEntities/mySensor/attributes
执行 POST 和
等负载
{
"attributes" : [
{
"name" : "temperature",
"type" : "float",
"value" : "26.5"
},
{
"name" : "pressure",
"type" : "integer",
"value" : "763"
}
]
}
从简单的 GET :1026/version 开始,看看它是否有效,然后再进行更高级的查询(请参阅 documentation 了解更多好东西:)
我设置了带有不同传感器的气象站。到目前为止,我的做法是将传感器数据发送到网址。但是现在我已经在服务器上设置了 CentOS 6.6 及其 IP 地址,所以现在我想将传感器数据直接发送到安装了 orion context broker 的机器。
所以我的问题是,我如何配置 orion context broker 来接受这些 post 发送到 CentOS 机器的请求(来自气象站传感器)?
向 运行 Orion Context Broker 的 CentOS 机器发送 post 请求应该没有任何问题。事实上,这是 运行 Orion 支持的 OS。
只需确保您打开了 Orion 将监听的端口(默认为 1026),并且 post 中的负载是可接受的。
例如,要发送一个值,您可以对 <host>:<port>/v1/contextEntities/mySensor/attributes
执行 POST 和
{
"attributes" : [
{
"name" : "temperature",
"type" : "float",
"value" : "26.5"
},
{
"name" : "pressure",
"type" : "integer",
"value" : "763"
}
]
}
从简单的 GET :1026/version 开始,看看它是否有效,然后再进行更高级的查询(请参阅 documentation 了解更多好东西:)