I am trying to define items using the http binding, but I can’t find how to do this. Retrieving items is not a problem but setting an item I am not able to…
Here is all the information that I have:
retrieve info:
http://toon/happ_thermstat?action=getThermostatInfo
answer:
{"result":"ok", "currentTemp":"2010", "currentSetpoint":"2000", "currentInternalBoilerSetpoint":"24", "programState":"1", "activeState":"0", "nextProgram":"1", "nextState":"2", "nextTime":"1548626400","nextSetpoint":"1600","randomConfigId":"168242560","errorFound":"255","connection":"0","burnerInfo":"0","otCommError":"0","currentModulationLevel":"0"}
set state:
http://toon/happ_thermstat?action=changeSchemeState&state=2&temperatureState=1
So these definitions work:
http.cfg:
ToonCacheTherm.url=http://192.168.3.175/happ_thermstat?action=getThermostatInfo
ToonCacheTherm.updateInterval=10000
toon.items:
Number ToonTemperature "Kamer temperatuur" { http="<[ToonCacheTherm:10000:JSONPATH($.currentTemp)]" }
Number ToonState { http="<[ToonCacheTherm:10000:JSONPATH($.activeState)]" }
But these do not:
/*
From the documentation
IN http="<[<url>:<refreshintervalinmilliseconds>:<transformationrule>]"
OUT http=">[<command>:<httpmethod>:<url>:<postcontent>]"
*/
Number SetState1 { http=">[CHANGED:GET:http://192.168.3.175/happ_thermstat?action=changeSchemeState&state=2&temperatureState=%2$" }
Number SetState2 { http="<[ToonCacheTherm:10000:JSONPATH($.activeState)] >[CHANGED:GET:http://192.168.3.175/happ_thermstat?action=changeSchemeState&state=2&temperatureState=%2$" }
So basically what I would like is to retrieve and set as follows:
Retrieve STATE from getThermostatInfo and json transfrom
Set STATE using: http://toon/happ_thermstat?action=changeSchemeState&state=2&temperatureState=STATE’
At the moment I am not sure if that is at all possible but I am sure that I do not know how