Simple integration with another REST API

Tags: #<Tag:0x00007f61828199e0> #<Tag:0x00007f6182819918> #<Tag:0x00007f6182819850>

Hi Community,
I really like openhab and version 2 looks promising. So far I was mainly using it with the zwave binding having excelent support in case of troubles and some UIs. Now I would like to add LaMetric as a notification sink into the system. So I have a silly question regarding integrating openhab with 3rd party services providing a REST API. Most of these APIs follow a simple pattern following the RESTful API design and requrire some Authentication (Usually OAuth or API Key)… So I was surprised to not find any binding or action to support the second most simple thing… POST a notification to a URL while also sending an HTTP Authentication Header.
Concrete this simple API:
http://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-notifications.html

So far I found 2 options:
a) HTTP Action in a script/rule => Does not work as it does not allow to send HTTP Headers (according to the documentation)
b) HTTP Binding => No possibility to send a Body (OK, workaround via exec plugin and curl mentioned, but really, this in the last days of 2016!?)
c) I have to write my own Action / Binding

So my questions are:

  1. Is the documentation incomplete and a) and/or b) is not true.
  2. Is there another option which I simply miss?
  3. Could I use low level Java Code like URLConnections in rules/scripts directly?
  4. Is somebody already integrating LaMetric or has an unoffical binding?

Thank you for all your input and the great work you did!

Hi Marco,
I also have a LaMetric device and also would like to integrate it in OpenHAB. I haven´t started working on it, but let you know if I come further with it. Maybe we could also start creating a own binding.

Regards,
Florian

Hi Florian,
I started now to create a binding and actions. It already supports changing display brightness via a things channel and actions for sending simple text notifications. Once it is a bit more stable I will share it via my github account. I will write here, when it is ready to be tested or extended…

conceptually I struggle a bit on how to expose indicator, button and alarm apps… probably I will also expose them via actions to be called from rules or scripts. Maybe you had some thoughts!?

I also created this issue on github: https://github.com/openhab/openhab2-addons/issues/1704

Regards
Marco

Thank you for the efforts building this binding! Just ordered a LaMetric (149 EUR in sale today @amazon) and will start testing soon.

Great! Please not that the effort has been almost complete and the related PR is:

Big credits go to @syphr42 as he contributed the substantial part of the PR…

1 Like

I’ve found this news by accident and I’m very glad to hear.
I own such an device and in my opinion would be perfect as message sink.