Warning
The openHAB bindings are still in beta, but the development was stopped.
This is the description of the openHAB API bindings for the HAT Brick. General information and technical specifications for the HAT Brick are summarized in its hardware description.
An installation guide for the openHAB API bindings is part of their general description.
UID:
- tinkerforge:brickhat:[UID]
Required firmware version:
- 2.0.3
Firmware update supported:
- yes
Channels: Actions: Parameters:
- Voltages Update Interval – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
- Specifies the update interval for the voltages 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
Sleep
¶Starts the configured sleep mode. Note: Triggering this will cut the Raspberry Pi's power after the configured amount of seconds. You have to shut down the operating system yourself, e.g. by calling 'sudo shutdown -h now'.
Type:
- Commands (String)
UID:
- tinkerforge:brickhat:[UID]:BrickHATSleep
Read only:
- No
Commands:
- Accepts any string
Parameters:
- Power Off Delay – Type: integer, Default: 60, Min: 0, Max: 4294967295
- Time in seconds before the RPi/Bricklets are powered off.
- Power Off Duration – Type: integer, Default: 10, Min: 0, Max: 4294967295
- Duration in seconds that the RPi/Bricklets stay powered off.
- Raspberry Pi Off – Type: boolean, Default: false
- Raspberry Pi is powered off if enabled.
- Bricklets Off – Type: boolean, Default: true
- Bricklets are powered off if enabled.
- Sleep Indicator – Type: boolean, Default: true
- If enabled, the status LED will blink in a 1s interval during the whole power off duration. This will draw additional 0.3mA.
Power Bricklets
¶Enable/disable to turn the power supply of the connected Bricklets on/off.
Type:
- Switch
UID:
- tinkerforge:brickhat:[UID]:BrickHATPowerBricklets
Read only:
- No
USB Voltage
¶The USB supply voltage.
There are three possible combinations:
Type:
- Number:ElectricPotential
UID:
- tinkerforge:brickhat:[UID]:BrickHATUSBVoltage
Read only:
- Yes
Unit:
- Volt
DC Voltage
¶The DC supply voltage.
There are three possible combinations:
Type:
- Number:ElectricPotential
UID:
- tinkerforge:brickhat:[UID]:BrickHATDCVoltage
Read only:
- Yes
Unit:
- Volt
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:brickhat:[UID]")
val hwVersion = actions.brickHATGetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))
brickHATSetSleepMode
(long powerOffDelay, long powerOffDuration, boolean raspberryPiOff, boolean brickletsOff, boolean enableSleepIndicator)¶Parameters: |
|
---|
Sets the sleep mode.
Note
Calling this function will cut the Raspberry Pi's power after Power Off Delay seconds. You have to shut down the operating system yourself, e.g. by calling 'sudo shutdown -h now'.
Parameters:
Example: To turn RPi and Bricklets off in 5 seconds for 10 minutes with sleep indicator enabled, call (5, 60*10, true, true, true).
This function can also be used to implement a watchdog. To do this you can write a program that calls this function once per second in a loop with (10, 2, true, false, false). If the RPi crashes or gets stuck the HAT will reset the RPi after 10 seconds.
brickHATGetSleepMode
()¶Return Map: |
|
---|
Returns the sleep mode settings as set by Sleep
.
brickHATSetBrickletPower
(boolean brickletPower)¶Parameters: |
|
---|
Set to true/false to turn the power supply of the connected Bricklets on/off.
brickHATGetBrickletPower
()¶Return Map: |
|
---|
Returns the power status of the connected Bricklets as set by Power Bricklets
.
brickHATGetVoltages
()¶Return Map: |
|
---|
Returns the USB supply voltage and the DC input supply voltage.
There are three possible combinations:
brickHATGetRTCDriver
()¶Return Map: |
|
---|
Returns the RTC driver as set by Blah.
The following constants are available for this function:
For rtcDriver:
New in version 2.0.3 (Firmware).
brickHATGetChipTemperature
()¶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.
brickHATGetStatusLEDConfig
()¶Return Map: |
|
---|
Returns the configuration as set by the thing configuration
The following constants are available for this function:
For config:
brickHATGetSPITFPErrorCount
()¶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.
brickHATReset
()¶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!