openHAB - Industrial Digital In 4 Bricklet 2.0

This is the description of the openHAB API bindings for the Industrial Digital In 4 Bricklet 2.0. General information and technical specifications for the Industrial Digital In 4 Bricklet 2.0 are summarized in its hardware description.

An installation guide for the openHAB API bindings is part of their general description.

Thing

UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]
Required firmware version:
  • 2.0.0
Firmware update supported:
  • yes
Channels:
Actions:
Parameters:
  • Status LED Config – Type: Choice, Default: Show Status
  • The status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets. You can also turn the LED permanently on/off or show a heartbeat. If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
  • Options: Off, On, Show Heartbeat, Show Status

Channels

Input Value 0

The logic level that is currently measured on the input.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2Input0
Read only:
  • No
Parameters:
  • Update Interval – Type: integer, Default: 100, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.

  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to Channel Status. In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Input Value 1

The logic level that is currently measured on the input.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2Input1
Read only:
  • No
Parameters:
  • Update Interval – Type: integer, Default: 100, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.

  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to Channel Status. In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Input Value 2

The logic level that is currently measured on the input.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2Input2
Read only:
  • No
Parameters:
  • Update Interval – Type: integer, Default: 100, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.

  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to Channel Status. In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Input Value 3

The logic level that is currently measured on the input.

Type:
  • Switch
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2Input3
Read only:
  • No
Parameters:
  • Update Interval – Type: integer, Default: 100, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.

  • LED Configuration – Type: Choice, Default: Show Channel Status
  • Each channel has a corresponding LED. You can turn the LED off, on or show a heartbeat. You can also set the LED to Channel Status. In this mode the LED is on if the channel is high and off otherwise.
  • Options: Off, On, Show Heartbeat, Show Channel Status
Edge Count Input 0

The current value of the edge counter for the selected channel

This channel will only update after the configured update interval, not on changed values.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2EdgeCountInput0
Read only:
  • Yes
Parameters:
  • Edge Type – Type: Choice, Default: Rising
  • The edge type parameter configures if rising edges, falling edges or both are counted.
  • Options: Rising, Falling, Both

  • Debounce Time – Type: integer, Default: 100, Min: 0, Max: 255
  • The debounce time in ms.

  • Reset Edge Count On Update – Type: boolean, Default: false
  • Enabling this will reset the edge counter after OpenHAB reads its value. Use this if you want relative edge counts per update.

  • Update Interval – Type: integer, Default: 1000, Unit: ms
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.
Edge Count Input 1

The current value of the edge counter for the selected channel

This channel will only update after the configured update interval, not on changed values.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2EdgeCountInput1
Read only:
  • Yes
Parameters:
  • Edge Type – Type: Choice, Default: Rising
  • The edge type parameter configures if rising edges, falling edges or both are counted.
  • Options: Rising, Falling, Both

  • Debounce Time – Type: integer, Default: 100, Min: 0, Max: 255
  • The debounce time in ms.

  • Reset Edge Count On Update – Type: boolean, Default: false
  • Enabling this will reset the edge counter after OpenHAB reads its value. Use this if you want relative edge counts per update.

  • Update Interval – Type: integer, Default: 1000, Unit: ms
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.
Edge Count Input 2

The current value of the edge counter for the selected channel

This channel will only update after the configured update interval, not on changed values.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2EdgeCountInput2
Read only:
  • Yes
Parameters:
  • Edge Type – Type: Choice, Default: Rising
  • The edge type parameter configures if rising edges, falling edges or both are counted.
  • Options: Rising, Falling, Both

  • Debounce Time – Type: integer, Default: 100, Min: 0, Max: 255
  • The debounce time in ms.

  • Reset Edge Count On Update – Type: boolean, Default: false
  • Enabling this will reset the edge counter after OpenHAB reads its value. Use this if you want relative edge counts per update.

  • Update Interval – Type: integer, Default: 1000, Unit: ms
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.
Edge Count Input 3

The current value of the edge counter for the selected channel

This channel will only update after the configured update interval, not on changed values.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialdigitalin4v2:[UID]:BrickletIndustrialDigitalIn4V2EdgeCountInput3
Read only:
  • Yes
Parameters:
  • Edge Type – Type: Choice, Default: Rising
  • The edge type parameter configures if rising edges, falling edges or both are counted.
  • Options: Rising, Falling, Both

  • Debounce Time – Type: integer, Default: 100, Min: 0, Max: 255
  • The debounce time in ms.

  • Reset Edge Count On Update – Type: boolean, Default: false
  • Enabling this will reset the edge counter after OpenHAB reads its value. Use this if you want relative edge counts per update.

  • Update Interval – Type: integer, Default: 1000, Unit: ms
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.

Actions

Actions can be used in rules by creating an action object. All actions return a Map<String, Object>. Returned values can be accessed by name, sometimes the type deduction needs some hints, as shown below:

val actions = getActions("tinkerforge", "tinkerforge:brickletindustrialdigitalin4v2:[UID]")
val hwVersion = actions.brickletIndustrialDigitalIn4V2GetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))

Basic Actions

brickletIndustrialDigitalIn4V2GetValue()
Return Map:
  • value – Type: boolean[], Length: 4

Returns the input value as bools, true refers to high and false refers to low.

brickletIndustrialDigitalIn4V2GetChannelLEDConfig(int channel)
Parameters:
  • channel – Type: int, Range: See constants
Return Map:
  • config – Type: int, Range: See constants, Default: 3

Returns the channel LED configuration as set by the configuration of Input Value 0

The following constants are available for this function:

For channel:

  • val CHANNEL_0 = 0
  • val CHANNEL_1 = 1
  • val CHANNEL_2 = 2
  • val CHANNEL_3 = 3

For config:

  • val CHANNEL_LED_CONFIG_OFF = 0
  • val CHANNEL_LED_CONFIG_ON = 1
  • val CHANNEL_LED_CONFIG_SHOW_HEARTBEAT = 2
  • val CHANNEL_LED_CONFIG_SHOW_CHANNEL_STATUS = 3

Advanced Actions

brickletIndustrialDigitalIn4V2GetEdgeCountConfiguration(int channel)
Parameters:
  • channel – Type: int, Range: See constants
Return Map:
  • edgeType – Type: int, Range: See constants, Default: 0
  • debounce – Type: int, Unit: 1 ms, Range: [0 to 255], Default: 100

Returns the edge type and debounce time for the selected channel as set by the configuration of Edge Count Input 0.

The following constants are available for this function:

For channel:

  • val CHANNEL_0 = 0
  • val CHANNEL_1 = 1
  • val CHANNEL_2 = 2
  • val CHANNEL_3 = 3

For edgeType:

  • val EDGE_TYPE_RISING = 0
  • val EDGE_TYPE_FALLING = 1
  • val EDGE_TYPE_BOTH = 2
brickletIndustrialDigitalIn4V2GetEdgeCount(int channel, boolean resetCounter)
Parameters:
  • channel – Type: int, Range: See constants
  • resetCounter – Type: boolean
Return Map:
  • count – Type: long, Range: [0 to 232 - 1]

Returns the current value of the edge counter for the selected channel. You can configure the edges that are counted with the configuration of Edge Count Input 0.

If you set the reset counter to true, the count is set back to 0 directly after it is read.

The following constants are available for this function:

For channel:

  • val CHANNEL_0 = 0
  • val CHANNEL_1 = 1
  • val CHANNEL_2 = 2
  • val CHANNEL_3 = 3
brickletIndustrialDigitalIn4V2GetChipTemperature()
Return Map:
  • temperature – Type: int, Unit: 1 °C, Range: [-215 to 215 - 1]

Returns the temperature as measured inside the microcontroller. The value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.

brickletIndustrialDigitalIn4V2GetStatusLEDConfig()
Return Map:
  • config – Type: int, Range: See constants, Default: 3

Returns the configuration as set by the thing configuration

The following constants are available for this function:

For config:

  • val STATUS_LED_CONFIG_OFF = 0
  • val STATUS_LED_CONFIG_ON = 1
  • val STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2
  • val STATUS_LED_CONFIG_SHOW_STATUS = 3
brickletIndustrialDigitalIn4V2GetSPITFPErrorCount()
Return Map:
  • errorCountAckChecksum – Type: long, Range: [0 to 232 - 1]
  • errorCountMessageChecksum – Type: long, Range: [0 to 232 - 1]
  • errorCountFrame – Type: long, Range: [0 to 232 - 1]
  • errorCountOverflow – Type: long, Range: [0 to 232 - 1]

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

  • ACK checksum errors,
  • message checksum errors,
  • framing errors and
  • overflow errors.

The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.

brickletIndustrialDigitalIn4V2GetIdentity()
Return Map:
  • uid – Type: String, Length: up to 8
  • connectedUid – Type: String, Length: up to 8
  • position – Type: char, Range: ['a' to 'h', 'i', 'z']
  • hardwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • firmwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • deviceIdentifier – Type: int, Range: [0 to 216 - 1]

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet connected to an Isolator Bricklet is always as position 'z'.

The device identifier numbers can be found here

Internal Actions

brickletIndustrialDigitalIn4V2ReadUID()
Return Map:
  • uid – Type: long, Range: [0 to 232 - 1]

Returns the current UID as an integer. Encode as Base58 to get the usual string version.