Bemerkung
Die openHAB-Dokumentation ist nur auf Englisch verfügbar.
Warnung
The openHAB bindings are still in beta, but the development was stopped.
This is the description of the openHAB API bindings for the DMX Bricklet. General information and technical specifications for the DMX Bricklet are summarized in its hardware description.
An installation guide for the openHAB API bindings is part of their general description.
The example code below is Public Domain (CC0 1.0).
Download (ExampleMaster.rules)
1 2 3 4 5 6 7 8 9 10 11 | // For this example configure your DMX Bricklet to Master Mode in Paper UI.
rule "send"
when
System started // Replace with trigger of your choice
then
// Change XYZ to the UID of your DMX Bricklet
val dmxActions = getActions("tinkerforge", "tinkerforge:brickletdmx:XYZ")
// Write DMX frame with 3 channels
dmxActions.brickletDMXWriteFrame(newArrayList(255, 128, 0))
end
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // For this example configure your DMX Bricklet to Slave Mode in Paper UI.
import java.util.Arrays
rule "receive"
when
// Change XYZ to the UID of your DMX Bricklet
Channel "tinkerforge:brickletdmx:XYZ:BrickletDMXFrameAvailable" triggered
then
// Change XYZ to the UID of your DMX Bricklet
val dmxActions = getActions("tinkerforge", "tinkerforge:brickletdmx:XYZ")
val frame = dmxActions.brickletDMXReadFrame()
logInfo("Example", "Frame Number:" + frame.get("frameNumber"))
logInfo("Example", "Frame:" + Arrays.toString(frame.get("frame") as int[]))
end
|
UID:
- tinkerforge:brickletdmx:[UID]
Required firmware version:
- 2.0.0
Firmware update supported:
- yes
Channels: Actions: Parameters:
- DMX Mode – Type: Choice, Default: Master
- Sets the DMX mode to either master or slave.
- Options: Master, Slave
- Communication LED – Type: Choice, Default: Show Communication
- By default the LED shows communication traffic, 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 off.
- Options: Off, On, Show Heartbeat, Show Communication
- Error LED Configuration – Type: Choice, Default: Show Error
- By default the error LED turns on if there is any error (see Frame Error Count Channel). If you call this function with the Show-Error option again, the LED will turn off until the next error occurs. You can also turn the LED permanently on/off or show a heartbeat. If the Bricklet is in bootloader mode, the LED is off.
- Options: Off, On, Show Heartbeat, Show Error
- Frame Duration – Type: integer, Default: -1, Min: -1, Max: 65535
- The duration of a frame. Example: If you want to achieve 20 frames per second, you should set the frame duration to 50ms (50ms * 20 = 1 second). If you always want to send a frame as fast as possible you can set this value to 0. To disable the frame started channel set this value to -1. This setting is only used in master mode.
- 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
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:brickletdmx:[UID]:BrickletDMXFrameStarted
Read only:
- No
Predicate:
- This channel will only be available if DMX Mode is Master.
Frame Available
¶This channel is triggered in slave mode when a new frame was received from the DMX master and it can be read out. You have to read the frame before the master has written the next frame using the readFrame action.
Type:
- Trigger (system.trigger)
UID:
- tinkerforge:brickletdmx:[UID]:BrickletDMXFrameAvailable
Read only:
- No
Predicate:
- This channel will only be available if DMX Mode is Slave.
Overrun Error Count
¶The number of occurred overrun errors
Type:
- Number:Dimensionless
UID:
- tinkerforge:brickletdmx:[UID]:BrickletDMXOverrunErrorCount
Read only:
- Yes
Framing Error Count
¶The number of occurred framing errors
Type:
- Number:Dimensionless
UID:
- tinkerforge:brickletdmx:[UID]:BrickletDMXFramingErrorCount
Read only:
- Yes
Clear Error LED
¶Clears the error LED.
Type:
- Commands (String)
UID:
- tinkerforge:brickletdmx:[UID]:BrickletDMXClearErrorLED
Read only:
- No
Predicate:
- This channel will only be available if Error LED Configuration is Show Error.
Commands:
- Accepts any string
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:brickletdmx:[UID]")
val hwVersion = actions.brickletDMXGetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))
brickletDMXWriteFrame
(int[] frame)¶Parameters: |
|
---|
Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
The next frame can be written after the Frame Started
channel was called. The frame
is double buffered, so a new frame can be written as soon as the writing of the prior frame
starts.
The data will be transfered when the next frame duration ends, see the thing configuration.
Generic approach:
Frame Started
channel.Frame Started
channel.This approach ensures that you can set new DMX data with a fixed frame rate.
This function can only be called in master mode.
brickletDMXGetDMXMode
()¶Return Map: |
|
---|
Returns the DMX mode, as set by the thing configuration.
The following constants are available for this function:
For dmxMode:
brickletDMXReadFrame
()¶Return Map: |
|
---|
Returns the last frame that was written by the DMX master. The size of the array is equivalent to the number of channels in the frame. Each byte represents one channel.
The next frame is available after the Frame Available
channel was called.
Generic approach:
ReadFrame()
to get first frame.Frame Available
channel.ReadFrame()
to get second frame.Frame Available
channel.The frame number starts at 0 and it is increased by one with each received frame.
This function can only be called in slave mode.
brickletDMXGetFrameDuration
()¶Return Map: |
|
---|
Returns the frame duration as set by the thing configuration.
brickletDMXGetFrameErrorCount
()¶Return Map: |
|
---|
Returns the current number of overrun and framing errors.
brickletDMXGetCommunicationLEDConfig
()¶Return Map: |
|
---|
Returns the configuration as set by the thing configuration
The following constants are available for this function:
For config:
brickletDMXGetErrorLEDConfig
()¶Return Map: |
|
---|
Returns the configuration as set by Clear Error LED
.
The following constants are available for this function:
For config:
brickletDMXGetChipTemperature
()¶Return Map: |
|
---|
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.
brickletDMXGetStatusLEDConfig
()¶Return Map: |
|
---|
Returns the configuration as set by the thing configuration
The following constants are available for this function:
For config:
brickletDMXGetSPITFPErrorCount
()¶Return Map: |
|
---|
Returns the error count for the communication between Brick and Bricklet.
The errors are divided into
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.
brickletDMXReset
()¶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!
brickletDMXGetIdentity
()¶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.