How to monitor your electricity consumption data in openHAB with OneMeter

16/04/2020 | Reading time: ~ 3 min. How to monitor your electricity consumption data in openHAB with OneMeter

OneMeter allows you to easily and non-invasively monitor the energy taken from and returned to the grid. The solution is so simple and versatile that it can be used at home as well as in a small business or industrial facility. Using the OneMeter API you can download all collected energy data to your openHAB installation. In this article, we’ll show you how to easily integrate. Let’s get started!

Outline

  1. Obtaining your device ID and API key
  2. Installing the necessary add-ons in openHab
    • HTTP Binding
    • JSONPath Transformation
    • Map Transformation
  3. Configuration
    • HTTP Binding
    • Item
    • SiteMap

1. Obtaining your device ID and API key

  • <DEVICE_ID> You can find the device ID at the bottom of your OneMeter device preview page on the [OneMeter Cloud] (https://cloud.onemeter.com/) platform (the UUID row in the Device Details table).
  • <API_KEY> Can be found at https://cloud.onemeter.com/#/api. If you do not have access to this section, please contact us and we will promptly give you access to the API.

Below is an example of the address that we will be using to download the relevant values from the OneMeter Cloud: https://cloud.onemeter.com/api/devices/<DEVICE_ID>?key=<API_KEY>

Be sure to remove the symbols < & >!

To check if the link we have created is error-free, paste it into your browser. If we have managed to do this step correctly, we should get a result similar to this:

2. Installing the necessary add-ons in openHab

HTTP Binding

With the help of Paper UI, install the HTTP Binding: Add-ons > BINDINGS > HTTP Binding > INSTALL

JSONPath and Map Transformation

With the help of Paper UI, install the JSONPath and Map Transformation: Add-ons > TRANSFORMATIONS > JSONPath Transformation/ Map Transformation > INSTALL

Configuration

Create the following files (or modify, if they already exist) with the content as shown below:

/etc/openhab2/services/http.cfg
onemeter.url=https://cloud.onemeter.com/api/devices/<DEVICE_ID>{Authorization=<API_KEY>}
onemeter.updateInterval=900000

Be sure to remove the symbols < & >!

/etc/openhab2/items/onemeter.items
Number onemeter_kwh "OneMeter kWh [%f]" <kwh> { http="<[onemeter:900000:JSONPATH($.lastReading.OBIS['15_8_0'])]" }
Number onemeter_voltage "OneMeter Battery Voltage [%f]" <voltage> { http="<[onemeter:900000:JSONPATH($.lastReading.OBIS['S_1_1_2'])]" }
DateTime onemeter_timestamp "OneMeter Last Readout [%t]" <timestamp> { http="<[onemeter:900000:JSONPATH($.lastReading.OBIS['S_1_1_4'])]" }
Number onemeter_this_month "OneMeter Current Consumption [%f]" <this_month> { http="<[onemeter:900000:JSONPATH($.usage['thisMonth'])]" }
Number onemeter_previous_month "OneMeter Previous Consumption [%f]" <previous_month> { http="<[onemeter:900000:JSONPATH($.usage['previousMonth'])]" }
String onemeter_firmware "OneMeter Firmware Version [%s]" <firmware> { http="<[onemeter:900000:JSONPATH($.firmware.['currentVersion'])]" }
/etc/openahb2/transform/onemeter.sitemap
sitemap onemeter label="OneMeter" {
  Frame label="OneMeter" {
    Text item=onemeter_kwh
    Text item=onemeter_voltage
    Text item=onemeter_timestamp
    Text item=onemeter_this_month
    Text item=onemeter_previous_month
    Text item=onemeter_firmware
  }
}

That’s it! If you got here, you managed to integrate OneMeter into openHAB.

If you have any problems, questions or suggestions, please contact us via our contact form - we will be happy to help!


Latest News

Jak z pomocą OneMeter pobierać dane o zużywanej energii elektrycznej do Domoticz

Jak z pomocą OneMeter pobierać dane o zużywanej energii elektrycznej do Domoticz

25/08/2020

Dzięki OneMeter możesz w bardzo prosty sposób monitorować energię pobieraną i oddawaną do sieci w domu lub w firmie. Za pomocą API OneMeter możesz na bieżąco zaciągnąć dane o energii do swojej instalacji Domoticz.

How to monitor your electricity consumption in Home Assistant with OneMeter

How to monitor your electricity consumption in Home Assistant with OneMeter

23/04/2020

Thanks to OneMeter, you can easily monitor the energy you consume and return back into the grid at home or at the office. Via the OneMeter API, you can pull energy data into your Home Assistant installation in real time.

249 225 16 0 0 0 1 10 349 315 16 99 99 12 1.23 10 299 269 16 0 0 1 10 399 359 16 99 12 1.23 10 0 0