Hi i have installed on my home an aerothermal system for the heating and cooling of the home.
I have installed Airzone for the zone control of this system. Airzone recently published a API for capture information an modify configuration of the zones.
I need send a post request with a json body for capture the information and a put request for modify options.
I see i can capture the diferent data with JSONPath Online Evaluator but i dont know how can i send the JSON body or send a Put request for modify the configuration.
I try to configure the post request with http binding but i dont know how to send the json body.
Could you help me please?
rule "Airzone"
when
Time cron "0 0/2 * ? * * *" //Every 5 minutes
then
val String url = "http://192.168.1.49:3000/api/v1/hvac"
val String typ = "application/json"
val int timeout = 5000 // ms
val sen = '{
"systemid": 1,
"zon eid": 13
}'
//url is incomplete in your link and 5 seconds time out
var jsonString = sendHttpPostRequest(url,typ,sen,timeout)
//TemperaturehG.sendCommand(transform("JSONPATH", "$.data[:1].roomTemp", jsonString))
postUpdate(TemperaturehG,transform("JSONPATH", "$.data[:1].roomTemp", jsonString))
end
But the result is
2019-09-26 21:00:03.547 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.ExecutionException: java.net.NoRouteToHostException: No existe ninguna ruta hasta el `hostâ
2019-09-26 21:00:03.548 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert ânullâ to a state type which item âTemperaturehGâ accepts: [DecimalType, QuantityType, UnDefType].
The error is pretty self explanatory. Your OH machine cannot access 192.168.1.49 for some reason. Perhaps you have a firewall in place or something else blocking the traffic?
I Share with the comunity the config (It is only first try, it need perform a better code):
ITEM
//////////////////////////
//AIRZONE////////////////
////////////////////////
Number Temperaturedos "Temperature [%.1f C]" <temperature> (RoomWeather)
Number Temperaturetres "Temperature [%.1f C]" <temperature> (RoomWeather)
Number Temperaturecuatro "Temperature [%.1f C]" <temperature> (RoomWeather)
Number Temperaturecinco "Temperature [%.1f C]" <temperature> (RoomWeather)
Number Temperatureseis "Temperature [%.1f C]" <temperature> (RoomWeather)
Number Temperaturesiete "Temperature [%.1f C]" <temperature> (RoomWeather)
Number Temperatureocho "Temperature [%.1f C]" <temperature> (RoomWeather)
SITEMAP
Text label="Airzone" icon="temperature"
{
Text item=Temperaturedos
Text item=Temperaturetres
Text item=Temperaturecuatro
Text item=Temperaturecinco
Text item=Temperatureseis
Text item=Temperaturesiete
Text item=Temperatureocho
}
RULES
rule "Airzone"
when
Time cron "0 0/5 * ? * * *" //Every 5 minutes
then
val String url = "http://192.168.1.49:3000/api/v1/hvac"
val String typ = "application/json"
val int timeout = 5000 // ms
val sen = '{
"systemid": 1,
"zoneid": 0
}'
//url is incomplete in your link and 5 seconds time out
var jsonString = sendHttpPostRequest(url,typ,sen,timeout)
//TemperaturehG.sendCommand(transform("JSONPATH", "$.data[:1].roomTemp", jsonString))
postUpdate(Temperaturedos,transform("JSONPATH", "$.data[0].roomTemp", jsonString))
postUpdate(Temperaturetres,transform("JSONPATH", "$.data[1].roomTemp", jsonString))
postUpdate(Temperaturecuatro,transform("JSONPATH", "$.data[2].roomTemp", jsonString))
postUpdate(Temperaturecinco,transform("JSONPATH", "$.data[3].roomTemp", jsonString))
postUpdate(Temperatureseis,transform("JSONPATH", "$.data[4].roomTemp", jsonString))
postUpdate(Temperaturesiete,transform("JSONPATH", "$.data[5].roomTemp", jsonString))
postUpdate(Temperatureocho ,transform("JSONPATH", "$.data[6].roomTemp", jsonString))
end
I am trying to have my AIRZONE working with OpenHAB.
I have tried to follow the guide to figure out how to reach the actual temperatures but I am facing some issues.
Here is the script:
val String url = âhttp://X.X.X.X:3000/api/v1/hvacâ
val String typ = âapplication/jsonâ
val int timeout = 5000 // ms
val sen = â{
âsystemidâ: 1,
âzoneidâ: 0
}â
//url is incomplete in your link and 5 seconds time out
var jsonString = sendHttpPostRequest(url,typ,sen,timeout)
//TemperaturehG.sendCommand(transform("JSONPATH", "$.data[:1].roomTemp", jsonString))
postUpdate(PLAYROOM,transform("JSONPATH", "$.data[0].roomTemp", jsonString))
postUpdate(SOGGIORNO,transform("JSONPATH", "$.data[1].roomTemp", jsonString))
postUpdate(BABIES,transform("JSONPATH", "$.data[2].roomTemp", jsonString))
postUpdate(MATRIMONIAL,transform("JSONPATH", "$.data[3].roomTemp", jsonString))
postUpdate(CUCINA,transform("JSONPATH", "$.data[4].roomTemp", jsonString))
When searching the words âopenhab airzoneâ in any search engine, this post is the first to come out, so Iâm taking the liberty to mention that I have created an AirZone binding that allows easy integration into openHAB 3.4 and upper.
It is available in the community marketplace and described here