openHAB - Remote Switch Bricklet 2.0

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 Remote Switch Bricklet 2.0. General information and technical specifications for the Remote Switch Bricklet 2.0 are summarized in its hardware description.

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

Usage

The remote switch 2.0 Bricklet functions as bridge for remote controlled mains switches and dimmers. Switches/dimmers must be added as things to openHAB manually with the Paper UI. The switch/dimmer thing can then be configured depending on the addressing type. (See hardware documentation)

Thing

UID:
  • tinkerforge:brickletremoteswitchv2:[UID]
Required firmware version:
  • 2.0.0
Firmware update supported:
  • yes
Channels:
Actions:
Parameters:
  • Remote Type – Type: Choice, Default: A
  • Type A, B or C depending on the type of remote you want to receive.
  • Options: A, B, C

  • Minimum Repeats – Type: integer, Default: 2, Min: 0, Max: 65535
  • The minimum number of repeated data packets until the Remote Status channels trigger.

  • 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

Switching Done

This channel is triggered whenever the switching state changes from busy to ready.

Type:
  • Trigger (system.trigger)
UID:
  • tinkerforge:brickletremoteswitchv2:[UID]:BrickletRemoteSwitchV2SwitchingDone
Read only:
  • No
Remote Status A Available

This channel is triggered if at least the configured minimum of repeats of identical data packets for remote type A were received. You can get the house and receiver code, switch state and repeats with the getRemoteStatusA action.

Type:
  • Trigger (system.trigger)
UID:
  • tinkerforge:brickletremoteswitchv2:[UID]:BrickletRemoteSwitchV2RemoteStatusAAvailable
Read only:
  • No
Remote Status B Available

This channel is triggered if at least the configured minimum of repeats of identical data packets for remote type B were received. You can get the house and receiver code, switch state and repeats with the getRemoteStatusB action.

Type:
  • Trigger (system.trigger)
UID:
  • tinkerforge:brickletremoteswitchv2:[UID]:BrickletRemoteSwitchV2RemoteStatusBAvailable
Read only:
  • No
Remote Status C Available

This channel is triggered if at least the configured minimum of repeats of identical data packets for remote type C were received. You can get the house and receiver code, switch state and repeats with the getRemoteStatusC action.

Type:
  • Trigger (system.trigger)
UID:
  • tinkerforge:brickletremoteswitchv2:[UID]:BrickletRemoteSwitchV2RemoteStatusCAvailable
Read only:
  • No

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

Basic Actions

brickletRemoteSwitchV2GetSwitchingState()
Return Map:
  • state – Type: int, Range: See constants

Returns the current switching state. If the current state is busy, the Bricklet is currently sending a code to switch a socket. It will not accept any calls of switch socket functions until the state changes to ready.

How long the switching takes is dependent on the number of repeats, see SetRepeats().

The following constants are available for this function:

For state:

  • val SWITCHING_STATE_READY = 0
  • val SWITCHING_STATE_BUSY = 1
brickletRemoteSwitchV2SwitchSocketA(int houseCode, int receiverCode, int switchTo)
Parameters:
  • houseCode – Type: int, Range: [0 to 31]
  • receiverCode – Type: int, Range: [0 to 31]
  • switchTo – Type: int, Range: See constants

To switch a type A socket you have to give the house code, receiver code and the state (on or off) you want to switch to.

A detailed description on how you can figure out the house and receiver code can be found here.

The following constants are available for this function:

For switchTo:

  • val SWITCH_TO_OFF = 0
  • val SWITCH_TO_ON = 1
brickletRemoteSwitchV2SwitchSocketB(long address, int unit, int switchTo)
Parameters:
  • address – Type: long, Range: [0 to 226 - 1]
  • unit – Type: int, Range: [0 to 15, 255]
  • switchTo – Type: int, Range: See constants

To switch a type B socket you have to give the address, unit and the state (on or off) you want to switch to.

To switch all devices with the same address use 255 for the unit.

A detailed description on how you can teach a socket the address and unit can be found here.

The following constants are available for this function:

For switchTo:

  • val SWITCH_TO_OFF = 0
  • val SWITCH_TO_ON = 1
brickletRemoteSwitchV2DimSocketB(long address, int unit, int dimValue)
Parameters:
  • address – Type: long, Range: [0 to 226 - 1]
  • unit – Type: int, Range: [0 to 15, 255]
  • dimValue – Type: int, Range: [0 to 255]

To control a type B dimmer you have to give the address, unit and the dim value you want to set the dimmer to.

A detailed description on how you can teach a dimmer the address and unit can be found here.

brickletRemoteSwitchV2SwitchSocketC(char systemCode, int deviceCode, int switchTo)
Parameters:
  • systemCode – Type: char, Range: ['A' to 'P']
  • deviceCode – Type: int, Range: [1 to 16]
  • switchTo – Type: int, Range: See constants

To switch a type C socket you have to give the system code, device code and the state (on or off) you want to switch to.

A detailed description on how you can figure out the system and device code can be found here.

The following constants are available for this function:

For switchTo:

  • val SWITCH_TO_OFF = 0
  • val SWITCH_TO_ON = 1
brickletRemoteSwitchV2GetRemoteConfiguration()
Return Map:
  • remoteType – Type: int, Range: See constants, Default: 0
  • minimumRepeats – Type: int, Range: [0 to 216 - 1], Default: 2
  • callbackEnabled – Type: boolean, Default: false

Returns the remote configuration as set by the thing configuration

The following constants are available for this function:

For remoteType:

  • val REMOTE_TYPE_A = 0
  • val REMOTE_TYPE_B = 1
  • val REMOTE_TYPE_C = 2
brickletRemoteSwitchV2GetRemoteStatusA()
Return Map:
  • houseCode – Type: int, Range: [0 to 31]
  • receiverCode – Type: int, Range: [0 to 31]
  • switchTo – Type: int, Range: See constants
  • repeats – Type: int, Range: [0 to 216 - 1]

Returns the house code, receiver code, switch state (on/off) and number of repeats for remote type A.

Repeats == 0 means there was no button press. Repeats >= 1 means there was a button press with the specified house/receiver code. The repeats are the number of received identical data packets. The longer the button is pressed, the higher the repeat number.

Use the channel to get this data automatically when a button is pressed, see the thing configuration and Remote Status A Available channel.

The following constants are available for this function:

For switchTo:

  • val SWITCH_TO_OFF = 0
  • val SWITCH_TO_ON = 1
brickletRemoteSwitchV2GetRemoteStatusB()
Return Map:
  • address – Type: long, Range: [0 to 226 - 1]
  • unit – Type: int, Range: [0 to 15]
  • switchTo – Type: int, Range: See constants
  • dimValue – Type: int, Range: [0 to 255]
  • repeats – Type: int, Range: [0 to 216 - 1]

Returns the address (unique per remote), unit (button number), switch state (on/off) and number of repeats for remote type B.

If the remote supports dimming the dim value is used instead of the switch state.

If repeats=0 there was no button press. If repeats >= 1 there was a button press with the specified address/unit. The repeats are the number of received identical data packets. The longer the button is pressed, the higher the repeat number.

Use the channel to get this data automatically when a button is pressed, see the thing configuration and Remote Status B Available channel.

The following constants are available for this function:

For switchTo:

  • val SWITCH_TO_OFF = 0
  • val SWITCH_TO_ON = 1
brickletRemoteSwitchV2GetRemoteStatusC()
Return Map:
  • systemCode – Type: char, Range: ['A' to 'P']
  • deviceCode – Type: int, Range: [1 to 16]
  • switchTo – Type: int, Range: See constants
  • repeats – Type: int, Range: [0 to 216 - 1]

Returns the system code, device code, switch state (on/off) and number of repeats for remote type C.

If repeats=0 there was no button press. If repeats >= 1 there was a button press with the specified system/device code. The repeats are the number of received identical data packets. The longer the button is pressed, the higher the repeat number.

Use the channel to get this data automatically when a button is pressed, see the thing configuration and Remote Status C Available channel.

The following constants are available for this function:

For switchTo:

  • val SWITCH_TO_OFF = 0
  • val SWITCH_TO_ON = 1

Advanced Actions

brickletRemoteSwitchV2SetRepeats(int repeats)
Parameters:
  • repeats – Type: int, Range: [0 to 255], Default: 5

Sets the number of times the code is sent when one of the Switch Socket functions is called. The repeats basically correspond to the amount of time that a button of the remote is pressed.

Some dimmers are controlled by the length of a button pressed, this can be simulated by increasing the repeats.

brickletRemoteSwitchV2GetRepeats()
Return Map:
  • repeats – Type: int, Range: [0 to 255], Default: 5

Returns the number of repeats as set by SetRepeats().

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

brickletRemoteSwitchV2GetStatusLEDConfig()
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
brickletRemoteSwitchV2GetSPITFPErrorCount()
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.

brickletRemoteSwitchV2Reset()

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!

brickletRemoteSwitchV2GetIdentity()
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

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