Home Elements Boards Recipes

OR Element

The OR Element combines multiple logic input values to a single output value. The output value will be true only when at least one of the input values is true.

Actions can be send to this element using the properties value[n]. Every time the value changes the onValue event is emitted.

Web UI for the OR Element

There is a dedicated card for this element available that will be used for the web server config and landing pages:

OR Web UI

This card shows the current output computed from the last logical input values. It is updated every time the status of the device is polled by the page.

Element Configuration

The up to 8 input values can be preset and the output can be inverted.

When no input value is given the output value is 0.

The non-inverted output value is on HIGH level when all input values are on HIGH level.

The Calc Element is used as a base class where the following properties are available for configuration:

type – (internal) This property controls how the input values are scanned and can be modified by the derived elements. The logical elements set this to datatype-boolean to enable scanning of true and false values. The datatype-numeric and is used by the AddElement for scanning numbers.

value[n] – The input values of the element are given using the value array notation. n must be in the range of 0 to 7.

invert – The boolean calculations result is inverted when this property is set to true.

onValue – These actions are emitted when the output value has changed.

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.

Configuration Example

{
  "or": {
    "o": {
      "value": [ "true", "false"],
      "invert": "false",
      "onValue": "device/0?log=or-output: $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.

Implementation Details

When input values have changed event is not created immediately but when the next loop function is called. This avoids flickering values on the output for a certain degree.

You can set values using a browser by sending actions to the element by requesting for the URLs like:

See also

Tags

Element