Home Elements Boards Recipes

Rotary Element

The RotaryElement is used to capture increments and decrements for values using a rotary encoder.

It can be used in combination with a Value Element to define a logical or numeric value that can be changed using the rotary encoder.

Rotary Encoder

This element uses the RotaryEncoder library available in the Arduino Library Manager.

Element Configuration

The following properties are available for configuration of the element:

pin1* – Specifies the hardware number of the first input pin.

pin2* – Specifies the hardware number of the second input pin.

step – Default:1 the increment/decrement value of one rotary step.

value – current value.

onValue – These actions are emitted when the value has changed. The delta from the last position is used as the value in this event.

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.

Example Configuration

{
  "rotary": {
    "in": {
      "description": "Rotary Input",
      "pin1": "D5",
      "pin2": "D6",
      "step": 10,
      "onValue": "value/led?up=$v"
    }
  }
}

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 State

The internal value can be seen in the rotary state but should not directly be used as a value.

{
  "rotary/in": {
    "active": "true",
    "value": "4"
  }
}

See also

Tags

Element Input