Because the tado binding only works in snapshot, I set up a secondary openHAB instance, just for tado. I now want to have certain items send values to my “real” openHAB instance, and vice versa. I thought the API would be the most easy way, and indeed, this works:
curl -v -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "15" "http://192.168.1.9:8080/rest/items/Verwarming_studieruimte_targetTemp"
However, I want to make a JavaScript rule, which triggers this POST request. I tried the following, without success:
actions.Exec.executeCommandLine(time.Duration.ofSeconds(5), "curl -v -X POST --header \'Content-Type: text/plain\' --header \'Accept: application/json\' -d \'15\' \'http://192.168.1.9:8080/rest/items/Verwarming_studieruimte_targetTemp\'")
Result:
12:39:34.948 [WARN ] [org.openhab.core.io.net.exec.ExecUtil] - Failed to execute commandLine '[curl -v -X POST --header 'Content-Type: text/plain' --header 'Accept: application/json' -d '15' 'http://192.168.1.9:8080/rest/items/Verwarming_studieruimte_targetTemp']'
I then read about actions.HTTP.sendHttpPostRequest()
, but I don’t understand its syntax. This doesn’t work:
actions.HTTP.sendHttpPostRequest("http://192.168.1.9:8080/rest/items/Verwarming_studieruimte_targetTemp", headers, "Content-Type: text/plain", headers, "Accept: application/json", data, "15")
Thanks in advance for anyone’s help!
(I also tried the Remote openHAB Binding, but if I want to update an item which is linked with the working tado binding, it always reverts to the value tado has, so I can’t change it.)