openHAB - Industrial Counter Bricklet

Warning

The openHAB bindings are still in beta, but the development was stopped.

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

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

Thing

UID:
  • tinkerforge:brickletindustrialcounter:[UID]
Required firmware version:
  • 2.0.0
Firmware update supported:
  • yes
Channels:
Actions:
Parameters:
  • Enable Channel 0 – Type: boolean, Default: true
  • Activates/deactivates the counter of channel 0.

  • Enable Channel 1 – Type: boolean, Default: true
  • Activates/deactivates the counter of channel 1.

  • Enable Channel 2 – Type: boolean, Default: true
  • Activates/deactivates the counter of channel 2.

  • Enable Channel 3 – Type: boolean, Default: true
  • Activates/deactivates the counter of channel 3.

  • Counter Update Interval – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval for all counters in milliseconds. A value of 0 disables automatic updates.

  • Signal Data Update Interval – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval for all signal data in milliseconds. A value of 0 disables automatic updates.

  • Status LED Configuration – 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

Channel 0 - Counter

The current counter value for the channel.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterCounterChannel0
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 0 is enabled.
Range:
  • -140737488355328 to 140737488355327 (Step 1)
Parameters:
  • Count Edge – Type: Choice, Default: Rising
  • The counter can count on rising, falling or both edges.
  • Options: Rising, Falling, Both

  • Count Direction – Type: Choice, Default: Up
  • The counter can count up or down. You can also use another channel as direction input: Channel 0 additionally supports to use the input of channel 2 as direction. You can configure channel 0 to count up if the value of channel 2 is high and down if the value is low and the other way around. Additionally channel 3 can use channel 1 as direction input in the same manner.
  • Options: Up, Down, External Up, External Down

  • Duty Cycle Prescaler – Type: Choice, Default: 1
  • Sets a divider for the internal clock. See `here `__ for details.
  • Options: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768

  • Frequency Integration Time – Type: Choice, Default: 1024 MS
  • Sets the integration time for the frequency measurement. See `here `__ for details.
  • Options: 128 MS, 256 MS, 512 MS, 1024 MS, 2048 MS, 4096 MS, 8192 MS, 16384 MS, 32768 MS

  • Channel LED – 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
Channel 1 - Counter

The current counter value for the channel.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterCounterChannel1
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 1 is enabled.
Range:
  • -140737488355328 to 140737488355327 (Step 1)
Parameters:
  • Count Edge – Type: Choice, Default: Rising
  • The counter can count on rising, falling or both edges.
  • Options: Rising, Falling, Both

  • Count Direction – Type: Choice, Default: Up
  • The counter can count up or down. You can also use another channel as direction input: Channel 0 additionally supports to use the input of channel 2 as direction. You can configure channel 0 to count up if the value of channel 2 is high and down if the value is low and the other way around. Additionally channel 3 can use channel 1 as direction input in the same manner.
  • Options: Up, Down, External Up, External Down

  • Duty Cycle Prescaler – Type: Choice, Default: 1
  • Sets a divider for the internal clock. See `here `__ for details.
  • Options: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768

  • Frequency Integration Time – Type: Choice, Default: 1024 MS
  • Sets the integration time for the frequency measurement. See `here `__ for details.
  • Options: 128 MS, 256 MS, 512 MS, 1024 MS, 2048 MS, 4096 MS, 8192 MS, 16384 MS, 32768 MS

  • Channel LED – 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
Channel 2 - Counter

The current counter value for the channel.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterCounterChannel2
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 2 is enabled.
Range:
  • -140737488355328 to 140737488355327 (Step 1)
Parameters:
  • Count Edge – Type: Choice, Default: Rising
  • The counter can count on rising, falling or both edges.
  • Options: Rising, Falling, Both

  • Count Direction – Type: Choice, Default: Up
  • The counter can count up or down. You can also use another channel as direction input: Channel 0 additionally supports to use the input of channel 2 as direction. You can configure channel 0 to count up if the value of channel 2 is high and down if the value is low and the other way around. Additionally channel 3 can use channel 1 as direction input in the same manner.
  • Options: Up, Down, External Up, External Down

  • Duty Cycle Prescaler – Type: Choice, Default: 1
  • Sets a divider for the internal clock. See `here `__ for details.
  • Options: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768

  • Frequency Integration Time – Type: Choice, Default: 1024 MS
  • Sets the integration time for the frequency measurement. See `here `__ for details.
  • Options: 128 MS, 256 MS, 512 MS, 1024 MS, 2048 MS, 4096 MS, 8192 MS, 16384 MS, 32768 MS

  • Channel LED – 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
Channel 3 - Counter

The current counter value for the channel.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterCounterChannel3
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 3 is enabled.
Range:
  • -140737488355328 to 140737488355327 (Step 1)
Parameters:
  • Count Edge – Type: Choice, Default: Rising
  • The counter can count on rising, falling or both edges.
  • Options: Rising, Falling, Both

  • Count Direction – Type: Choice, Default: Up
  • The counter can count up or down. You can also use another channel as direction input: Channel 0 additionally supports to use the input of channel 2 as direction. You can configure channel 0 to count up if the value of channel 2 is high and down if the value is low and the other way around. Additionally channel 3 can use channel 1 as direction input in the same manner.
  • Options: Up, Down, External Up, External Down

  • Duty Cycle Prescaler – Type: Choice, Default: 1
  • Sets a divider for the internal clock. See `here `__ for details.
  • Options: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768

  • Frequency Integration Time – Type: Choice, Default: 1024 MS
  • Sets the integration time for the frequency measurement. See `here `__ for details.
  • Options: 128 MS, 256 MS, 512 MS, 1024 MS, 2048 MS, 4096 MS, 8192 MS, 16384 MS, 32768 MS

  • Channel LED – 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
Channel 0 - Duty Cycle

The signal's duty cycle.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterDutyCycle0
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 0 is enabled.
Unit:
  • Percent
Range:
  • 0 Percent to 100 Percent (Step 0.01 Percent)
Channel 1 - Duty Cycle

The signal's duty cycle.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterDutyCycle1
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 1 is enabled.
Unit:
  • Percent
Range:
  • 0 Percent to 100 Percent (Step 0.01 Percent)
Channel 2 - Duty Cycle

The signal's duty cycle.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterDutyCycle2
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 2 is enabled.
Unit:
  • Percent
Range:
  • 0 Percent to 100 Percent (Step 0.01 Percent)
Channel 3 - Duty Cycle

The signal's duty cycle.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterDutyCycle3
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 3 is enabled.
Unit:
  • Percent
Range:
  • 0 Percent to 100 Percent (Step 0.01 Percent)
Channel 0 - Period

The signal's period

Type:
  • Number:Time
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterPeriod0
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 0 is enabled.
Unit:
  • Second
Channel 1 - Period

The signal's period

Type:
  • Number:Time
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterPeriod1
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 1 is enabled.
Unit:
  • Second
Channel 2 - Period

The signal's period

Type:
  • Number:Time
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterPeriod2
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 2 is enabled.
Unit:
  • Second
Channel 3 - Period

The signal's period

Type:
  • Number:Time
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterPeriod3
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 3 is enabled.
Unit:
  • Second
Channel 0 - Frequency

The signal's frequency.

Type:
  • Number:Frequency
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterFrequency0
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 0 is enabled.
Unit:
  • Hertz
Channel 1 - Frequency

The signal's frequency.

Type:
  • Number:Frequency
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterFrequency1
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 1 is enabled.
Unit:
  • Hertz
Channel 2 - Frequency

The signal's frequency.

Type:
  • Number:Frequency
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterFrequency2
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 2 is enabled.
Unit:
  • Hertz
Channel 3 - Frequency

The signal's frequency.

Type:
  • Number:Frequency
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterFrequency3
Read only:
  • Yes
Predicate:
  • This channel will only be available if Enable Channel 3 is enabled.
Unit:
  • Hertz
Channel 0 - Value

The signal's current value

Type:
  • Contact
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterValue0
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 0 is enabled.
Channel 1 - Value

The signal's current value

Type:
  • Contact
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterValue1
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 1 is enabled.
Channel 2 - Value

The signal's current value

Type:
  • Contact
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterValue2
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 2 is enabled.
Channel 3 - Value

The signal's current value

Type:
  • Contact
UID:
  • tinkerforge:brickletindustrialcounter:[UID]:BrickletIndustrialCounterValue3
Read only:
  • No
Predicate:
  • This channel will only be available if Enable Channel 3 is enabled.

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:brickletindustrialcounter:[UID]")
val hwVersion = actions.brickletIndustrialCounterGetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))

Basic Actions

brickletIndustrialCounterGetCounter(int channel)
Parameters:
  • channel – Type: int, Range: See constants
Return Map:
  • counter – Type: long, Range: [-247 to 247 - 1]

Returns the current counter value for the given channel.

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
brickletIndustrialCounterGetAllCounter()
Return Map:
  • counter – Type: long[], Length: 4, Range: [-247 to 247 - 1]

Returns the current counter values for all four channels.

brickletIndustrialCounterSetCounter(int channel, long counter)
Parameters:
  • channel – Type: int, Range: See constants
  • counter – Type: long, Range: [-247 to 247 - 1]

Sets the counter value for the given channel.

The default value for the counters on startup is 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
brickletIndustrialCounterSetAllCounter(long[] counter)
Parameters:
  • counter – Type: long[], Length: 4, Range: [-247 to 247 - 1]

Sets the counter values for all four channels.

The default value for the counters on startup is 0.

brickletIndustrialCounterGetSignalData(int channel)
Parameters:
  • channel – Type: int, Range: See constants
Return Map:
  • dutyCycle – Type: int, Unit: 1/100 %, Range: [0 to 10000]
  • period – Type: long, Unit: 1 ns, Range: [0 to 264 - 1]
  • frequency – Type: long, Unit: 1/1000 Hz, Range: [0 to 232 - 1]
  • value – Type: boolean

Returns the signal data (duty cycle, period, frequency and value) for the given channel.

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
brickletIndustrialCounterGetAllSignalData()
Return Map:
  • dutyCycle – Type: int[], Length: 4, Unit: 1/100 %, Range: [0 to 10000]
  • period – Type: long[], Length: 4, Unit: 1 ns, Range: [0 to 264 - 1]
  • frequency – Type: long[], Length: 4, Unit: 1/1000 Hz, Range: [0 to 232 - 1]
  • value – Type: boolean[], Length: 4

Returns the signal data (duty cycle, period, frequency and value) for all four channels.

brickletIndustrialCounterGetCounterActive(int channel)
Parameters:
  • channel – Type: int, Range: See constants
Return Map:
  • active – Type: boolean, Default: true

Returns the activation state of the given channel.

true = activated, false = deactivated.

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
brickletIndustrialCounterGetAllCounterActive()
Return Map:
  • active – Type: boolean[], Length: 4, Default: {true, true, true, true}

Returns the activation state of all four channels.

true = activated, false = deactivated.

brickletIndustrialCounterGetCounterConfiguration(int channel)
Parameters:
  • channel – Type: int, Range: See constants
Return Map:
  • countEdge – Type: int, Range: See constants, Default: 0
  • countDirection – Type: int, Range: See constants, Default: 0
  • dutyCyclePrescaler – Type: int, Range: See constants, Default: 0
  • frequencyIntegrationTime – Type: int, Range: See constants, Default: 3

Returns the counter configuration as set by the configuration of Channel 0 - Counter.

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 countEdge:

  • val COUNT_EDGE_RISING = 0
  • val COUNT_EDGE_FALLING = 1
  • val COUNT_EDGE_BOTH = 2

For countDirection:

  • val COUNT_DIRECTION_UP = 0
  • val COUNT_DIRECTION_DOWN = 1
  • val COUNT_DIRECTION_EXTERNAL_UP = 2
  • val COUNT_DIRECTION_EXTERNAL_DOWN = 3

For dutyCyclePrescaler:

  • val DUTY_CYCLE_PRESCALER_1 = 0
  • val DUTY_CYCLE_PRESCALER_2 = 1
  • val DUTY_CYCLE_PRESCALER_4 = 2
  • val DUTY_CYCLE_PRESCALER_8 = 3
  • val DUTY_CYCLE_PRESCALER_16 = 4
  • val DUTY_CYCLE_PRESCALER_32 = 5
  • val DUTY_CYCLE_PRESCALER_64 = 6
  • val DUTY_CYCLE_PRESCALER_128 = 7
  • val DUTY_CYCLE_PRESCALER_256 = 8
  • val DUTY_CYCLE_PRESCALER_512 = 9
  • val DUTY_CYCLE_PRESCALER_1024 = 10
  • val DUTY_CYCLE_PRESCALER_2048 = 11
  • val DUTY_CYCLE_PRESCALER_4096 = 12
  • val DUTY_CYCLE_PRESCALER_8192 = 13
  • val DUTY_CYCLE_PRESCALER_16384 = 14
  • val DUTY_CYCLE_PRESCALER_32768 = 15

For frequencyIntegrationTime:

  • val FREQUENCY_INTEGRATION_TIME_128_MS = 0
  • val FREQUENCY_INTEGRATION_TIME_256_MS = 1
  • val FREQUENCY_INTEGRATION_TIME_512_MS = 2
  • val FREQUENCY_INTEGRATION_TIME_1024_MS = 3
  • val FREQUENCY_INTEGRATION_TIME_2048_MS = 4
  • val FREQUENCY_INTEGRATION_TIME_4096_MS = 5
  • val FREQUENCY_INTEGRATION_TIME_8192_MS = 6
  • val FREQUENCY_INTEGRATION_TIME_16384_MS = 7
  • val FREQUENCY_INTEGRATION_TIME_32768_MS = 8
brickletIndustrialCounterGetChannelLEDConfig(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 Channel 0 - Counter

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

brickletIndustrialCounterGetChipTemperature()
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.

brickletIndustrialCounterGetStatusLEDConfig()
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
brickletIndustrialCounterGetSPITFPErrorCount()
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.

brickletIndustrialCounterReset()

Calling this function will reset the Bricklet. All configurations will be lost.

After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!

brickletIndustrialCounterGetIdentity()
Return Map:
  • uid – Type: String, Length: up to 8
  • connectedUid – Type: String, Length: up to 8
  • position – Type: char, Range: ['a' to 'h', '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). A Bricklet connected to an Isolator Bricklet is always at position 'z'.

The device identifier numbers can be found here

Internal Actions

brickletIndustrialCounterReadUID()
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.