Home Elements Boards Recipes

ADD Element

The ADD Element sums up multiple input values to create a single output value.

Actions can be send to this element using the properties value[n]. Every time the value changes the onValue event is emitted with the sum of all input values.

Web UI for the ADD Element

The standard card for this element is used showing the current calculated output value.

Element Configuration

The up to 8 input values can be used for calculation. When no input value is given the output value is 0.

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

This example shows how to configure this element:

{
  "add": {
    "a": {
      "value": [ 1, 2, 3 ],
      "onValue": "device/0?log=add-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