Commit 05a91eb1 by Martin Kotula

Documentation

parent 6b0f3413
# Occupancy Sensor Hub
The sole purpose of the hub is to gather sensor readings through a HTPP action and publish messages furhter to the MQTT Broker.
This is .net CORE web API app.
## Prerequisites
* [.net CORE 2 preview 1](https://github.com/dotnet/core/blob/master/release-notes/2.0/2.0.0-preview1.md)
## Installation guide
Open command line and navigate to project root. Run following commands:
* `dotnet restore`
* `dotnet run`
\ No newline at end of file
# Occupancy sensors
## Sensors
Autonomous sensors which need to be able to report their state over HTTP or directly to MQTT Broker. Our goal was to design the sensors in a way that would not require cable connections
### Technology Stack
C++
### Challenges
* Power supply, the prototype of the sensor is using a 9V battery/hour
* Problems with the quality of available components - couple of chips got burned during assembly
## Hub
Hub is a .NET core web API application which only purpose is to listen to sensor readings through a HTTP POST action and publish messages to the MQTT broker.
> We had technical difficulty in communicating directly with MQTT broker from the sensor code. It was easier to report sensor state through a HTTP request.
In the original plan hub was supposed to play a more sophisticated role:
* Gather statistics
* Expose richer API
### API
`POST /api/status/write`
This endpoint take the JSON object from request body and simply publishes to the MQTT broker without any alterations.
### Instance
Example instance of the hub has been deployed to a Rapberry PI connected to e1s network / Azure App Service
### Installation guide
Installation guide can be found: [here](/Pi.Hub.Api/)
### Technology Stack
C#, .net CORE 2 preview 1
## MQTT Broker
We are using [MQTT](http://mqtt.org) as our pub/sub protocol. It's a lightweight protocol designed for IoT purposes.
Our PoC is using a public instance of open source MQTT broker [Mosquitto](http://mosquitto.org) exposed under [http://test.mosquitto.org](http://test.mosquitto.org)
> **Note**: This is a public instance of the mqtt broker which can be unstable and run experimental versions of the software.
We are publishing a messages under `e1s/iot.challange` using the unecrypted, default endpoint [mqtt://test.mosquitto.org:8080](mqtt://test.mosquitto.org:8080)
> **Note**: Since the endpoint is public everyone can subscribe and publish to it.
### Data contract
Message published to the MQTT broker should be a following JSON object
```json
{
sensorId: string,
isBusy: boolean
}
```
## Clients
### Web dashboard
We have prepared an example client in a form of a static web page which subsribes to the MQTT broker under `e1s/iot.challange` topic and displays the current status of any available sensor.
> **NOTE**: This app does not have any persitance layer so it needs to wait for any sensor to report it's status.
### Instance
Example instance has been exposed under [http://edge1-iot.azurewebsites.net/](http://edge1-iot.azurewebsites.net/)
using Azure App Service hosting
#### Installation guide
Installation guide can be found [here](/UI.Web.Dashboard)
#### Technology Stack
JS, Knockout-JS, MQTT-JS, npm, gulp, bootstrap
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment