Documentation

Switch Control

The switch control is the simplest control type, reading digital on or off and firing only on state change.

Overview

The switch control is the simplest of control types and only reads digital on or off. The switch will only fire an event once the state has changed from its previous value. This means a switch will not continue to fire even though it is in an active state.

Configuration

Set the type to switch in your control configuration:

JSON
{
  "controls": [
    {
      "pin": 12,
      "type": "switch",
      "name": "Flow Sensor Toggle"
    }
  ]
}

Settings

Property Value Description
type switch Control type identifier

Returns

Boolean — The switch returns a digital true or false value.

Note

The switch only fires an event when the state changes. If you need continuous events while active, use the button control instead.