Hello,
I am quite new to OH and have been struggling to do something which is probably very difficult.
I have an airconditioner system which wirelessly with a cloud service (ninja).
There is a web service (http://www.actronair.com.au/aconnect/#/Control) and the web server at https://actron.ninja.is/rest/v0/device/xxxx?user_access_token=xxxx displays the following:
{“result”:1,“error”:null,“id”:0,“data”:{“vid”:2,“did”:4,“device_type”:“airconditioner”,“default_name”:“Air Conditioner Settings”, “tags”:“aircon”, “is_sensor”:1, “is_actuator”:1, “is_silent”:0, “has_time_series”:0, “has_subdevice_count”:0, “has_state”:0, “gid”:“0”, “guid”:“xxx_0_2_4”, “node”:“xxx”, “meta”:{},“shortName”:"", “subDevices”:{}, “last_data”:{“DA”:{“amOn”:true,“tempTarget”:23,“mode”:1,“fanSpeed”:0,“enabledZones”:[1,1,0,0,0,0,0,0]},“timestamp”:1499413530689}}}
I have created an item:
Switch aconnect "Air Conditioner Power" (all) { autoupdate="true" }
and the sitemap is very simple
Switch item=aconnect
I have tried to modify sample rules which I researched online but firstly i am not even confident they are being triggered, let alone sending the the right data to the webserver.
Someone has done it using the Fibaro system so I know it is possible to communicate with the web server and issue commands - i just don’t know if it is possible to do so with OH and how to format the commands correctly. I tried with sendhttpgetrequest but again, I just don’t think I have used the correct code.
I have pasted the code below which was used by the other person
local http = net.HTTPClient()
jsonTable = {DA={amOn=true}}
jsonString = json.encode(jsonTable)
http:request('https://actron.ninja.is/rest/v0/device/XXXX?user_access_token=XXXX',{
options = {
method = "PUT",
data = jsonString,
headers = {
[ 'Content-Type' ] = 'application/json'
}
},
success = function(response) fibaro:debug(response.data) end,
error = function(err) fibaro:debug("Error: " ..err) end
})
Any help would really be very much appreciated as I am tearing out what little hair I have and my wife misses her husband