openHAB - Energy Monitor 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 Energy Monitor Bricklet. General information and technical specifications for the Energy Monitor Bricklet are summarized in its hardware description.

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

Thing

UID:
  • tinkerforge:brickletenergymonitor:[UID]
Required firmware version:
  • 2.0.0
Firmware update supported:
  • yes
Channels:
Actions:
Parameters:
  • Energy Data Update Interval – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval for all energy 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

Voltage

Root mean square voltage.

Integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement). If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

Type:
  • Number:ElectricPotential
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorVoltage
Read only:
  • Yes
Unit:
  • Volt
Current

Root mean square current.

Integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement). If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

Type:
  • Number:ElectricCurrent
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorCurrent
Read only:
  • Yes
Unit:
  • Ampere
Energy

Energy (integrated over time)

Integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement). If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

Type:
  • Number:Energy
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorEnergy
Read only:
  • Yes
Unit:
  • Watt Hour
Real Power

Real Power

Integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement). If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

Type:
  • Number:Power
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorRealPower
Read only:
  • Yes
Unit:
  • Watt
Apparent Power

Apparent Power

Integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement). If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorApparentPower
Read only:
  • Yes
Reactive Power

Reactive Power

Integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement). If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorReactivePower
Read only:
  • Yes
Power Factor

Power Factor

Integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement). If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

Type:
  • Number:Dimensionless
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorPowerFactor
Read only:
  • Yes
Frequency

AC Frequency of the mains voltage

The frequency is recalculated every 6 seconds.

Type:
  • Number:Frequency
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorFrequency
Read only:
  • Yes
Unit:
  • Hertz
Reset Energy Value

Sets the energy value back to 0 Wh

Type:
  • Commands (String)
UID:
  • tinkerforge:brickletenergymonitor:[UID]:BrickletEnergyMonitorResetEnergy
Read only:
  • No
Commands:
  • Accepts any string

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

Basic Actions

brickletEnergyMonitorGetEnergyData()
Return Map:
  • voltage – Type: int, Unit: 1/100 V, Range: [-231 to 231 - 1]
  • current – Type: int, Unit: 1/100 A, Range: [-231 to 231 - 1]
  • energy – Type: int, Unit: 1/100 Wh, Range: [-231 to 231 - 1]
  • realPower – Type: int, Unit: 1/100 W, Range: [-231 to 231 - 1]
  • apparentPower – Type: int, Unit: 1/100 VA, Range: [-231 to 231 - 1]
  • reactivePower – Type: int, Unit: 1/100 var, Range: [-231 to 231 - 1]
  • powerFactor – Type: int, Unit: 1/1000, Range: [0 to 216 - 1]
  • frequency – Type: int, Unit: 1/100 Hz, Range: [0 to 216 - 1]

Returns all of the measurements that are done by the Energy Monitor Bricklet.

  • Voltage RMS
  • Current RMS
  • Energy (integrated over time)
  • Real Power
  • Apparent Power
  • Reactive Power
  • Power Factor
  • Frequency (AC Frequency of the mains voltage)

The frequency is recalculated every 6 seconds.

All other values are integrated over 10 zero-crossings of the voltage sine wave. With a standard AC mains voltage frequency of 50Hz this results in a 5 measurements per second (or an integration time of 200ms per measurement).

If no voltage transformer is connected, the Bricklet will use the current waveform to calculate the frequency and it will use an integration time of 10 zero-crossings of the current waveform.

brickletEnergyMonitorResetEnergy()

Sets the energy value (see Voltage) back to 0Wh.

brickletEnergyMonitorGetWaveform()
Return Map:
  • waveform – Type: int[], Length: 1536, Range: [-215 to 215 - 1]

Returns a snapshot of the voltage and current waveform. The values in the returned array alternate between voltage and current. The data from one getter call contains 768 data points for voltage and current, which correspond to about 3 full sine waves.

The voltage is given with a resolution of 100mV and the current is given with a resolution of 10mA.

This data is meant to be used for a non-realtime graphical representation of the voltage and current waveforms.

brickletEnergyMonitorGetTransformerStatus()
Return Map:
  • voltageTransformerConnected – Type: boolean
  • currentTransformerConnected – Type: boolean

Returns true if a voltage/current transformer is connected to the Bricklet.

brickletEnergyMonitorGetTransformerCalibration()
Return Map:
  • voltageRatio – Type: int, Range: [0 to 216 - 1], Default: 1923
  • currentRatio – Type: int, Range: [0 to 216 - 1], Default: 3000
  • phaseShift – Type: int, Range: [0], Default: 0

Returns the transformer calibration as set by This function is not available in openHAB. Please use Brick Viewer to change persistant device settings.

Advanced Actions

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

brickletEnergyMonitorGetStatusLEDConfig()
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
brickletEnergyMonitorGetSPITFPErrorCount()
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.

brickletEnergyMonitorReset()

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!

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

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