Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "IoT/M2MIWG/Demonstrator"

< IoT
(Software)
m (Webmaster.eclipse.org moved page Iot/M2MIWG/Demonstrator to IoT/M2MIWG/Demonstrator)
 
(7 intermediate revisions by 3 users not shown)
Line 41: Line 41:
  
 
Source code of the demonstrator (Mihini and Arduino embedded + Web UI) will be available on Mihini examples source code repository: http://git.eclipse.org/c/mihini/org.eclipse.mihini.samples.git
 
Source code of the demonstrator (Mihini and Arduino embedded + Web UI) will be available on Mihini examples source code repository: http://git.eclipse.org/c/mihini/org.eclipse.mihini.samples.git
 +
 +
== REST API ==
 +
 +
The Raspberry Pi gateway bridging the greenhouse sensors to the Internet is running Mihini and communicating with m2m.eclipse.org using M3DA.
 +
The gateway's deviceID is: <code>RPI000000006f257df2</code>
 +
The Mihini application running on the gateway is managing a <code>greenhouse</code> asset that has a <code>data</code> tree node holding all the values related to the sensors, that is:
 +
* <code>luminosity</code> - an integer indicating the luminosity level in the greenhouse
 +
* <code>humidity</code> - an integer indicating the humidity level in the greenhouse
 +
* <code>temperature</code> - an integer indicating the temperature in the greenhouse
 +
* <code>open</code> - a boolean indicating whether the roof is opened or not
 +
 +
=== Getting sensor data ===
 +
 +
An HTTP GET on the following URL: http://m2m.eclipse.org/m3da/clients/RPI000000006f257df2/data returns a JSON document containing the latest values sent by the Mihini application.
 +
More specifically, there are entries for all the values of the <code>greenhouse</code> asset.
 +
 +
<source lang="javascript">
 +
{
 +
  "greenhouse.data.luminosity": [{
 +
    "value": [69.626168224299],
 +
    "timestamp": "1369418402000000"
 +
  }, {
 +
    "value": [56.666666666667],
 +
    "timestamp": "1369418401000000"
 +
  }],
 +
  "greenhouse.data.humidity": [{
 +
    "value": [41.555555555556],
 +
    "timestamp": "1369418402000000"
 +
  }, {
 +
    "value": [37.333333333333],
 +
    "timestamp": "1369418401000000"
 +
  }],
 +
  "greenhouse.data.open": [{
 +
    "value": [true],
 +
    "timestamp": "1369418402000000"
 +
  }, {
 +
    "value": [true],
 +
    "timestamp": "1369418401000000"
 +
  }],
 +
  "greenhouse.data.temperature": [{
 +
    "value": [25.745177707255],
 +
    "timestamp": "1369418402000000"
 +
  }, {
 +
    "value": [25.745177707255],
 +
    "timestamp": "1369418401000000"
 +
  }]
 +
}
 +
</source>
 +
 +
=== Sending commands ===
 +
 +
You should do an HTTP POST on the http://m2m.eclipse.org/m3da/clients/RPI000000006f257df2/data URL, with a payload in the form of a JSON document indicating what values to update on the Mihini system. Since the Mihini application has registered callbacks on specific data paths, this is a way to execute commands, like e.g. closing the roof, by posting the following JSON document:
 +
 +
<source lang="javascript">
 +
{
 +
  "settings" : [{
 +
      "key" : "greenhouse.commands.data.toggleRoof.state",
 +
      "value" : false
 +
  }]
 +
}
 +
</source>

Latest revision as of 10:18, 4 February 2014

Warning2.png
Draft Content
This page is currently under construction. Community members are encouraged to maintain the page, and make sure the information is accurate.


The M2M Industry Working Group is working on setting up a demonstrator of the technologies that are being developed under its umbrella.

It has been decided to go with the use case of a connected greenhouse, reporting its status (temperature, humidity, luminosity) and being controllable (turning artificial lighting on/off).

Purpose

Members of the M2M Industry Working Group or interested parties are invited to use the same setup for showcasing their commercial products based on the Eclipse M2M projects, and promoting the interoperability of their solutions.

For members of the IWG only, it will be possible to promote their solution on m2m.eclipse.org in the form of a small description and a link to their own website.

Suggestions of "commercial" scenarios

  • connect the Raspberry Pi based greenhouse to your commercial server product using MQTT or M3DA
  • promote an implementation of the greenhouse using your commercial embedded framework but connect it to the public m2m.eclipse.org broker (M3DA or MQTT)

Demonstrator setup

Overview

Demo.png

Hardware

Greenhouse.png

Software

A new section on m2m.eclipse.org website will feature a Web UI displaying the live value coming from the greenhouse sensors as well as allow to send commands (switch light on/off). The live stream of a webcam pointed towards the greenhouse will also be included on this page.

Source code of the demonstrator (Mihini and Arduino embedded + Web UI) will be available on Mihini examples source code repository: http://git.eclipse.org/c/mihini/org.eclipse.mihini.samples.git

REST API

The Raspberry Pi gateway bridging the greenhouse sensors to the Internet is running Mihini and communicating with m2m.eclipse.org using M3DA. The gateway's deviceID is: RPI000000006f257df2 The Mihini application running on the gateway is managing a greenhouse asset that has a data tree node holding all the values related to the sensors, that is:

  • luminosity - an integer indicating the luminosity level in the greenhouse
  • humidity - an integer indicating the humidity level in the greenhouse
  • temperature - an integer indicating the temperature in the greenhouse
  • open - a boolean indicating whether the roof is opened or not

Getting sensor data

An HTTP GET on the following URL: http://m2m.eclipse.org/m3da/clients/RPI000000006f257df2/data returns a JSON document containing the latest values sent by the Mihini application. More specifically, there are entries for all the values of the greenhouse asset.

{
  "greenhouse.data.luminosity": [{
    "value": [69.626168224299],
    "timestamp": "1369418402000000"
  }, {
    "value": [56.666666666667],
    "timestamp": "1369418401000000"
  }],
  "greenhouse.data.humidity": [{
    "value": [41.555555555556],
    "timestamp": "1369418402000000"
  }, {
    "value": [37.333333333333],
    "timestamp": "1369418401000000"
  }],
  "greenhouse.data.open": [{
    "value": [true],
    "timestamp": "1369418402000000"
  }, {
    "value": [true],
    "timestamp": "1369418401000000"
  }],
  "greenhouse.data.temperature": [{
    "value": [25.745177707255],
    "timestamp": "1369418402000000"
  }, {
    "value": [25.745177707255],
    "timestamp": "1369418401000000"
  }]
}

Sending commands

You should do an HTTP POST on the http://m2m.eclipse.org/m3da/clients/RPI000000006f257df2/data URL, with a payload in the form of a JSON document indicating what values to update on the Mihini system. Since the Mihini application has registered callbacks on specific data paths, this is a way to execute commands, like e.g. closing the roof, by posting the following JSON document:

{
   "settings" : [{
      "key" : "greenhouse.commands.data.toggleRoof.state",
      "value" : false
  }]
}

Back to the top