Warning
The openHAB bindings are still in beta, but the development was stopped.
This is the description of the openHAB API bindings for the LED Strip Bricklet. General information and technical specifications for the LED Strip Bricklet are summarized in its hardware description.
An installation guide for the openHAB API bindings is part of their general description.
UID:
- tinkerforge:brickletledstrip:[UID]
Required firmware version:
- 2.0.6
Firmware update supported:
- yes
Channels: Actions: Parameters:
- LED Driver Chip Type – Type: Choice, Default: WS2801
- The type of the LED driver chip. We currently support the chips
- WS2801
- WS2811
- WS2812 / SK6812 / NeoPixel RGB
- SK6812RGBW / NeoPixel RGBW (Chip Type = WS2812)
- LPD8806
- APA102 / DotStar
- Options: WS2801, WS2811, WS2812, LPD8806, APA102
- LED Channel Mapping – Type: Choice, Default: BGR
- The channel mapping for the connected LEDs. If the mapping has 4 colors, the LED Values channel expects 4 values per pixel and if the mapping has 3 colors it expects 3 values per pixel. The LED Values channel always expects the order RGB(W). The connected LED driver chips might have their 3 or 4 channels in a different order. For example, the WS2801 chips typically use BGR order, then WS2812 chips typically use GRB order and the APA102 chips typically use WBGR order. The APA102 chips are special. They have three 8-bit channels for RGB and an additional 5-bit channel for the overall brightness of the RGB LED making them 4-channel chips. Internally the brightness channel is the first channel, therefore one of the Wxyz channel mappings should be used. Then the W channel controls the brightness.
- Options: RGB, RBG, BRG, BGR, GRB, GBR, RGBW, RGWB, RBGW, RBWG, RWGB, RWBG, GRWB, GRBW, GBWR, GBRW, GWBR, GWRB, BRGW, BRWG, BGRW, BGWR, BWRG, BWGR, WRBG, WRGB, WGBR, WGRB, WBGR, WBRG
- Frame Duration – Type: integer, Default: 1000, Min: 0, Max: 65535
- The frame duration in milliseconds. This configures how fast the Frame Started Channel will trigger.
- Clock Frequency – Type: integer, Default: 1666666, Min: 10000, Max: 2000000
- The frequency of the clock in Hz. The Bricklet will choose the nearest achievable frequency, which may be off by a few Hz. If you have problems with flickering LEDs, they may be bits flipping. You can fix this by either making the connection between the LEDs and the Bricklet shorter or by reducing the frequency. With a decreasing frequency your maximum frames per second will decrease too.
- Enable Frame Started Channel – Type: boolean, Default: false
- Enables the frame started channel. This will result in a lot of spam in the openhab Log!
Frame Started
¶This channel is triggered directly after a new frame render is started. You should send the data for the next frame directly after this listener was triggered.
Type:
- Trigger (system.trigger)
UID:
- tinkerforge:brickletledstrip:[UID]:BrickletLEDStripFrameStarted
Read only:
- No
Predicate:
- This channel will only be available if Enable Frame Started Channel is enabled.
LED Values
¶The RGB(W) values for the LEDs. Changes will be applied the next time the Frame Started Channel triggers.
Command format is a ','-separated list of integers. The first integer is the index of the first LED (not the first value!) to set, additional integers are the values to set. If the channel mapping has 3 colors, you need to give the data in the sequence R,G,B,R,G,B,R,G,B,... if the channel mapping has 4 colors you need to give data in the sequence R,G,B,W,R,G,B,W,R,G,B,W...
The data is double buffered and the colors will be transfered to the LEDs when the next frame duration ends. You can set at most 960 values (320 RGB or 240 RGBW LEDs).
For example sending 2,255,0,0,0,255,0,0,0,255 will set the LED 2 to red, LED 3 to green and LED 4 to blue.
Type:
- String
UID:
- tinkerforge:brickletledstrip:[UID]:BrickletLEDStripLEDValues
Read only:
- No
All LEDs
¶This channel allows you to set a configurable amount of LEDs (up to 240 RGBW LEDs or 320 RGB LEDs) to the same color. If you want more fine-grained control over the LEDs, use the LED Values channel or the actions.
Type:
- Color - Only HSBType commands are accepted. Updating the brightness without changing the hue (e.g. by sending a PercentType) may fail.
UID:
- tinkerforge:brickletledstrip:[UID]:BrickletLEDStripAllLEDs
Read only:
- No
Parameters:
- LEDs – Type: integer, Default: 0, Min: 0, Max: 320
- The number of LEDs to control.
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:brickletledstrip:[UID]")
val hwVersion = actions.brickletLEDStripGetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))
brickletLEDStripSetRGBValues
(int index, short length, short[] r, short[] g, short[] b)¶Parameters: |
|
---|
Sets length RGB values for the LEDs starting from index.
To make the colors show correctly you need to configure the chip type (the thing configuration) and a 3-channel channel mapping (the thing configuration) according to the connected LEDs.
Example: If you set
the LED with index 5 will be red, 6 will be green and 7 will be blue.
Note
Depending on the LED circuitry colors can be permuted.
The colors will be transfered to actual LEDs when the next frame duration ends, see the thing configuration.
Generic approach:
Frame Started
channel.Frame Started
channel.This approach ensures that you can change the LED colors with a fixed frame rate.
The actual number of controllable LEDs depends on the number of free
Bricklet ports. See here for more
information. A call of LED Values
with index + length above the
bounds is ignored completely.
brickletLEDStripGetRGBValues
(int index, short length)¶Parameters: |
|
---|---|
Return Map: |
|
Returns length R, G and B values starting from the given LED index.
The values are the last values that were set by LED Values
.
brickletLEDStripGetFrameDuration
()¶Return Map: |
|
---|
Returns the frame duration as set by the thing configuration.
brickletLEDStripGetSupplyVoltage
()¶Return Map: |
|
---|
Returns the current supply voltage of the LEDs.
brickletLEDStripGetClockFrequency
()¶Return Map: |
|
---|
Returns the currently used clock frequency as set by the thing configuration.
New in version 2.0.1 (Plugin).
brickletLEDStripGetChipType
()¶Return Map: |
|
---|
Returns the currently used chip type as set by the thing configuration.
The following constants are available for this function:
For chip:
New in version 2.0.2 (Plugin).
brickletLEDStripSetRGBWValues
(int index, short length, short[] r, short[] g, short[] b, short[] w)¶Parameters: |
|
---|
Sets length RGBW values for the LEDs starting from index.
To make the colors show correctly you need to configure the chip type (the thing configuration) and a 4-channel channel mapping (the thing configuration) according to the connected LEDs.
The maximum length is 12, the index goes from 0 to 239 and the rgbw values have 8 bits each.
Example: If you set
the LED with index 5 will be red, 6 will be green, 7 will be blue and 8 will be white.
Note
Depending on the LED circuitry colors can be permuted.
The colors will be transfered to actual LEDs when the next frame duration ends, see the thing configuration.
Generic approach:
Frame Started
channel.Frame Started
channel.This approach ensures that you can change the LED colors with a fixed frame rate.
The actual number of controllable LEDs depends on the number of free
Bricklet ports. See here for more
information. A call of LED Values
with index + length above the
bounds is ignored completely.
The LPD8806 LED driver chips have 7-bit channels for RGB. Internally the LED Strip Bricklets divides the 8-bit values set using this function by 2 to make them 7-bit. Therefore, you can just use the normal value range (0-255) for LPD8806 LEDs.
The brightness channel of the APA102 LED driver chips has 5-bit. Internally the LED Strip Bricklets divides the 8-bit values set using this function by 8 to make them 5-bit. Therefore, you can just use the normal value range (0-255) for the brightness channel of APA102 LEDs.
New in version 2.0.6 (Plugin).
brickletLEDStripGetRGBWValues
(int index, short length)¶Parameters: |
|
---|---|
Return Map: |
|
Returns length RGBW values starting from the given index.
The values are the last values that were set by LED Values
.
New in version 2.0.6 (Plugin).
brickletLEDStripGetChannelMapping
()¶Return Map: |
|
---|
Returns the currently used channel mapping as set by the thing configuration.
The following constants are available for this function:
For mapping:
New in version 2.0.6 (Plugin).
brickletLEDStripGetIdentity
()¶Return Map: |
|
---|
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.