How do I configure context broker accept post requests from my remote sensor?

落爺英雄遲暮 提交于 2019-12-11 04:36:07

问题


I have set my weather station with different sensors attached. My practice until now was to send the sensor data to a web address. But now that I have set up a CentOS 6.6 on a server with its IP address so now I want to send the sensor data directly to that machine that has orion context broker installed.

So my question is, how do I configure orion context broker to accept these post requests (from the weather station sensors) that are being sent to the CentOS machine?


回答1:


You shouldn't have any problem sending post requests to a CentOS machine that is running Orion Context Broker. In fact, that is the supported OS for running Orion.

Just make sure you have the port open that Orion will be listening at (by default it's 1026), and that the payload in the post is acceptable.

For example, to send a value you could do a POST to <host>:<port>/v1/contextEntities/mySensor/attributes and a payload such as

{
  "attributes" : [
  {
    "name" : "temperature",
    "type" : "float",
    "value" : "26.5"
  },
  {
    "name" : "pressure",
    "type" : "integer",
    "value" : "763"
  }
  ]
}

Start out simple by doing a GET :1026/version to see if it works and work up to more advanced queries (see the documentation for more good stuff :)



来源:https://stackoverflow.com/questions/29531646/how-do-i-configure-context-broker-accept-post-requests-from-my-remote-sensor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!