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.
rule AddPowerData
when
Item MyPowerData changed
then
sendHttpGetRequest("http://(volkszaehler-IP)/middleware.php/data/(Channel-UUID).json?operation=add&value=" + MyPowerData.state.toString)
end
rule KNX_K1_Leistung_Add
when
Item KNX_K1_Leistung received update
then
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)
sendHttpGetRequest(url)