Documentation
¶
Overview ¶
OttO is a set of Go packages (framework) that help build IoT applications. The goal is to decouple the IoT sensors, actuators, etc. from the framework hardware interfaces such as GPIO, I2C, serial ports, etc.
Features include ¶
Device level abstraction. Each device has a name that translates into a path that can be used by MQTT and HTTP REST interface for communication with other systems.
Device manager that keeps track of all application devices, configuration and status. This interface attempts to be agnostic to the underlying drivers, including gpiocdev, I2C, periph.io, etc.
Message based architecture abstracting all communications into a standard message format. With functionality that can save messages for later replay or diagnostics.
MQTT messaging built into all devices and components according to functionality and need
HTTP Rest interface and corresponding API for all components of the framework.
Drivers for a few different breakout boards meant to run on the Raspberry Pi.
Station module to represent a single application on a given device or a series of stations for a networked controller.
Messanger (not to be confused with messages) implements a Pub/Sub (MQTT or other) interface between components of your application
HTTP REST Server for data gathering and configuration ¶
Websockets for realtime bidirectional communication with a UI ¶
High performance Web server built in to serve interactive UI's and modern API's
Station manager to manage the stations that make up an entire sensor network
Data Manager for temporary data caching and interfaces to update your favorite cloud based timeseries database
Message library for standardized messages built to be communicate events and information between pacakges.
The primary communication model for OttO is a messaging system based on the Pub/Sub model defaulting to MQTT. oTTo is also heavily invested in HTTP to implement user interfaces and REST/Graph APIs.
Messaging and HTTP use paths to specify the subject of interest. These paths can be generically reduced to an ordered collection of strings seperated by slashes '/'. Both MQTT topics, http URI's and UNIX filesystems use this same schema which we use the generalize the identity of the elements we are addressing.
In other words we can generalize the following identities:
For example:
File: /home/rusty/data/hb/temperature HTTP: /api/data/hb/temperature MQTT: ss/station/hb/temperature
The data within the highest level topic temperature can be represented say by JSON `{ farenhiet: 100.07 }`
### Meta Data (Station Information)
For example when a station comes alive it can provide some information about itself using the topic:
```ss/m/be:ef:ca:fe:02/station```
The station will announce itself along with some meta information and it's capabilities. The body of the message might look something like this:
```json
{
"id": "be:ef:ca:fe:02",
"ip": "10.11.24.24",
"sensors": [
"tempc",
"humidity",
"light"
],
"relays": [
"heater",
"light"
],
}
```
### Sensor Data
Sensor data takes on the form:
```ss/d/<station>/<sensor>/<index>```
Where the source is the Station ID publishing the respective data. The sensor is the type of data being produced (temp, humidity, lidar, GPS).
The index is useful in application where there is more than one device, such as sensors, motors, etc.
The value published by the sensors is typically going to be floating point, however these values may also be integers, strings or byte arrays.
### Control Data
```ss/c/<source>/<device>/<index>```
This is essentially the same as the sensor except that control commands are used to have a particular device change, for example turning a relay on or off.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version string Interactive bool )
global variables and structures
Functions ¶
This section is empty.
Types ¶
type Controller ¶
Controller is a message handler that oversees all interactions with the application.
type OttO ¶
type OttO struct {
Name string
*station.Station
*station.StationManager
*server.Server
messanger.Messanger
Mock bool
MQTTBroker string // MQTT broker URL, defaults to test.mosquitto.org
UseLocal bool // Force use of local messaging
// contains filtered or unexported fields
}
OttO is a large wrapper around the Station, Server, DataManager and Messanger, including some convenience functions.
func (*OttO) AddManagedDevice ¶ added in v0.0.10
AddManagedDevice creates a managed device wrapper and adds it to the station
func (*OttO) GetManagedDevice ¶ added in v0.0.10
func (o *OttO) GetManagedDevice(name string) *station.ManagedDevice
GetManagedDevice retrieves a managed device by name
Directories
¶
| Path | Synopsis |
|---|---|
|
otto
command
|
|
|
Demo program showing the new flexible logging configuration
|
Demo program showing the new flexible logging configuration |
|
Package messanger provides a unified interface for publish-subscribe messaging in the Otto IoT framework.
|
Package messanger provides a unified interface for publish-subscribe messaging in the Otto IoT framework. |