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 www.volkszaehler.org 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.
Item MyPowerData changed
sendHttpGetRequest("http://(volkszaehler-IP)/middleware.php/data/(Channel-UUID).json?operation=add&value=" + MyPowerData.state.toString)
exactly, it needs to be a HTTP GET.
This is my take on the script:
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)