Skip to content

Config specification

Skurydin Alexey edited this page Feb 6, 2016 · 11 revisions

Config contains different sections. Each section describes part of node connections, scripts and etc.

Global section

  • name - unique Node name

network

Connection configuration

  • ssid
  • password

mqtt

MQTT broker connection config

  • host
  • port

sensors

List of attached sensors. Node will automatically read all sensors with configured interval and send data to MQTT broker, show in web interface and etc.

Typical block for sensor with single pin and single value:

"SensorName1": // It will be used as part of variable name
{
  "type": "DS1820", // Sensor type, it's optional if SensorName == type
  "pins": 2, // Connected to pin 2
  "output": "t_external", // How output variable should be named (sensor has one value, so it's single name)
  "changed": "doSomething();" // We can add our scripting here, optional
}

Typical block for sensor with multiple pins and multiple output values (not required to be both in same time, just example):

"SecondSensorName": // It will be used as name of variable
{
  "type": "dht20900_plus", // Just for example
  "pins": {"data": 0, "clock": 2, "reset": 16},
  "output": {"temperature": "t", "humidity": "rh"} // name for every sensor value
  "changed": "doSomethingOther();"
}

As result after this two configuration blocks you will have three variables on your node:

  • SensorName1.t_external
  • SecondSensorName.t
  • SecondSensorName.rh

All variables accessible via:

  • MQTT
  • Web interface
  • Internal scripts (triggers can switch slaves dependent on sensor values)

Also,

  • "type" can be skipped if SensorName == SensorType
  • "changed" can be skiped always, of course

slaves

Section what describes slave devices which your Node will control.

"Slave1Name": pin1,
"Slave2Name": pin2,
...

triggers

Section for automatic trigers - scripts\algorithms which do actions automatically, without any external command. It can read sensor values and control slaves.

"TriggerName": "doTrigAction();"

timers

Timers section. Timer can do any action with configured inteval

"TimerName1":
{
  "interval": 12345, // In milliseconds
  "enabled": true, // Is timer started for begining or not (if not, it can be started after from trigger, for example)
  "action": "doSomethingOther();"
}
Clone this wiki locally