Home Elements Boards Recipes

Digital Input Element

The DigitalInElement is used to capture digital input signal and create actions based on level changes. This can e.g. be used to capture actively from buttons and switches but also some sensors offer a digital output as a 0 / 1 value.

The physical input level can differ from the logical input level. E.g. momentary input buttons may pull an input down to ground while others pull them up. Also switches can be used with this Element.

Element Configuration

The following properties are available for configuration of the element.

pin* - Specifies the hardware number of the pin.

invert - In normal mode a HIGH input value is reported as value 1. In invert mode a LOW input value is reported as value 1. Normal mode is default.

pullup - When defining with true the internal pullup resistor for the input pin will be activated.

onHigh - Actions.
These actions are emitted when the logical level is switched to 1.

onLow - Actions.
These actions are emitted when the logical level is switched to 0.

onValue - Actions.
These actions are emitted when the logical level is switched.

From the base element implementation the following properties are available for configuration:

title – Caption text for the element. Used by the element specific cards on the dash boards.

description – A line of text that gives a short description of the device used in the web UI.

room – The location of the device.

loglevel – This property holds the element specific log level. The default value is LOGGER_LEVEL_ERR == 1.

startup – This property can be used to start the element using a different initialization phase. Possible values are “sys”, “net”, “time”. See The Startup sequence.

* This parameter must be specified.

Element State

The following properties are available with the current values at runtime

active - Is set to true when the element is active.

value - Current output value of the element.

Example Configuration

{
  "digitalin": {
    "start": {
      "pin": "D7",
      "invert": "true",
      "pullup": "true",
      "onHigh": "device/0?log=start.",
      "onLow": " device/0?log=stop.",
      "onValue": "device/0?log=input($v)"
    }
  }
}

Example State

{
  "digitalin/start": {
    "active": "true",
    "value": "1"
  }
}

See also

Tags

Element Input