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

Promising energy-oriented startup is willing to expand thanks to 1 million  investment!

Promising energy-oriented startup is willing to expand thanks to 1 million investment!

31/03/2021

OneMeter is a start-up in a growth phase. Our focus is the new technology and innovation in the field of energy usage and monitoring. This year, having tested our pilot and sales possibilities on Polish market, we have gained recognition in our industry.

czego nie spodziewaliśmy się tworząc dla Was naszą aplikację na iOS?

Status: "To skomplikowane" - czego nie spodziewaliśmy się tworząc dla Was naszą aplikację na iOS?

15/02/2021

Ponad rok temu poinformowaliśmy naszych klientów o tym, że pracujemy nad wypuszczeniem naszej aplikacji dla urządzeń z systemem operacyjnym iOS. Mieliśmy już w pełni funkcjonalną aplikację na systemy Android, więc byliśmy przekonani, że już niebawem ukaże się analogiczna wersja dla użytkowników urządzeń Apple.

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