Hello,
i try to use a rule with sendHttpGetRequest with a json-url and actually i get some illegal characters errors.
I tried to find a solution and found urlencoder but i still get follow error.
==> openhab.log <==
2018-03-12 22:06:39.994 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Steckdose’: Invalid URI host: null (authority: 192.168.22.12%2F%3Fcmd%3D200%26json%3D%7Bport%3A1%2Cstate%3A1%7D)
thats the rule file:
import java.net.URLEncoder
rule "Steckdose"
when
Item gPower received command
then
switch(receivedCommand) {
case ON :{
var poweron = URLEncoder::encode('/?cmd=200&json={port:1,state:1}','UTF-8');
sendHttpGetRequest("http://192.168.22.12" + poweron);
}
case OFF:
{
var poweroff = URLEncoder::encode('/?cmd=200&json={port:1,state:0}','UTF-8');
sendHttpGetRequest("http://192.168.22.12" + poweroff);
}
}
end
anybody know a solution?
Regards, Web