Using HTTP Action to push data into the middleware?

Hi all,

I have a KNX smartmeter that gives me data on some circuits via the knx bus. I can access the values (power, voltage, current, etc.) in some openHAB items.

What I want to do now, is write a rule that uses the HTTP Action to push these values out to the middleware of a installation since I have a few other meters that log their data into the volkszaehler, and I would like to keep the power data centralized.

Would anyone happen to have a rule that does this or something similar that I can use as a starting point?

The URL that I would need to post roughly looks like:

http://(volkszaehler-IP)/middleware.php/data/(Channel-UUID).json?operation=add&value=(value of item)



When you say β€œpost” but the URL contains the data, I’m assuming the receiver will accept an HTTP GET request.

rule AddPowerData
  Item MyPowerData changed
  sendHttpGetRequest("http://(volkszaehler-IP)/middleware.php/data/(Channel-UUID).json?operation=add&value=" + MyPowerData.state.toString)
1 Like

exactly, it needs to be a HTTP GET.

This is my take on the script:

import org.openhab.core.library.types.*

rule KNX_K1_Leistung_Add
Item KNX_K1_Leistung received update
var String str = "http://(ip)/middleware.php/data/"
var String uuid = "(uuid).json"
var String operation = β€œ?operation=add&value=”

    var String value = KNX_K1_Leistung.state.toString
    var String url = str + uuid + operation + value
    logInfo("knxsmartmeter K1 Leistung: ", url)