Json Configuration


                                
                                
                                





Instructions

Before reading further, be sure to pick your target platform at the top right! This determines what capabilities OmniThing has. For example, you won't be able to configure a GPIO pin on a windows computer.

WARNING: If you leave this configuration tool without downloading the json file, you will have lost all your progress! That includes going to the homepage of this site.

Config

The Config tab allows you to see the current json representation of your configuration. It also has several buttons:

New Configuration

Erases current config and creates a blank one

Import Configuration

Imports an existing json configuration file from your filesystem that you want to edit.

Download JSON config

Downloads the current configuration as a json file. Be sure to save your changes before downloading.

Download Arduino Header

Downloads an arduino header file representation of the current configuration. This is useful if you want to build out of the same arduino sketch folder. Simply overwrite ArduinoJsonConfig.h with the newly downloaded version.

Download Arduino Sketch

Downloads a zip file including a ready-to-build arduino sketch. This includes your configuration already in the proper header format. Just unzip the file, and open the sketch in the arduino IDE. That's all there is to it. Also, the zip file includes the json representation of your configuration (named config.json). This can be used to import back into the editor if you want to make changes.

Devices

Devices correspond directly to SmartThings devices. If you want anything to show up in SmartThings, you need to have a device for it! On the devices tab, you can create, delete, and edit devices.

Click on a device's name to edit it. Devices are composed of several kinds of parameters. There are rudimentary ones such as booleans, numbers, strings, and enums. There are also more complex input/output types named InputBool, InputFloat, InputUInt, OutputVoid, OutputBool, OutputFloat, and OutputString (with more potentially being added down the line).

These types determine how the device interacts with the real world. A contact sensor requires an input parameter. This is represented as an InputBool type. A common choice for an InputBool would be a digital input pin on a microcontroller. Likewise, a switch requires an OutputBool. Maybe you want to make your raspberry pi switch a pin on and off. Alternatively, you could make your switch make your pi send a web request using a shell script. You get to choose when you configure the output parameter of the switch!

When a complex parameter has not been configured yet, you can click the "Create" button found under its description. In the pop-up window, you will get to choose what type it will be. If you change your mind, simply click delete and then create again.

NOTE: Whenever you need to specify a pin number, reference the board pinouts found in the README at the OmniThing GitHub page.

Triggers

Every device allows you to optionally add triggers. Triggers are basically timed events. You can input an interval (in milliseconds), an optional offset (also in milliseconds), and select from the list of commands you can give the device. Every device has a "poll" command. This makes the device send its current status to SmartThings. You will likely want at least one trigger for every device, issuing a poll command. Other devices like Switches allow you to send more commands such as "on", "off", and "toggle".

Subscriptions

Every device can have subscriptions. Subscriptions are very similar to triggers, but they fire based on events rather than timers. You select a source device, an event from that device, and finally the command to give the subscribing device. Subscriptions allow for simple things like turning on a switch when a contact sensor opens. They are not meant to be a full-fledged rule engine, so use something like WebCore for complicated automation.

Composite Peripherals

Composite Peripherals represent sensors/actuators that read in multiple values. They are similar to devices, but they do NOT correspond to SmartThings Devices. They also have no triggers or subscriptions.

Using composite peripherals requires two steps. Create the composite peripheral first. Composite peripherals expose multiple attributes, which can be booleans, floats, or uints. For example, the DhtReader peripheral exposes two float attributes, temperature and humidity. Next, create a device that will use the peripheral. Using the DHT example, you can create a TemperatureMeasurement device and a RelativeHumidityMeasurement device.

Devices can use special types of inputs to get a value from a composite peripheral. These are called InputBoolRef, InputFloatRef, and InputUIntRef. These ref types allow you to select a source composite peripheral and one of its attributes. In the DHT example, our two devices would each use an InputFloatRef for its input. The temperature device would select the temperature attribute, and the humidity device would choose the humidity attribute.

You may wonder why OmniThing even has Composite Peripherals. Why not just have a DHT22 device? Devices are meant to be very generic. A temperature reading device can receive its input from any InputFloat. This makes OmniThing flexible and very easy to expand.

Network Receiver

The network receiver defines how OmniThing will receive data from SmartThings. It is pretty straight forward. Select a port to listen on. On some platforms you must also specify the IP of the device OmniThing is running on.

Network Sender

The network sender is responsible for sending data to SmartThings. Typically you must specify the ip address and port of your SmartThings hub.


Devices



Composite Peripherals



Network Receiver

Network Sender