CCU2 Cuxd Curl script

Support for our english speaking visitors

Moderator: Co-Administratoren

Antworten
sborkuti
Beiträge: 10
Registriert: 14.10.2018, 13:31

CCU2 Cuxd Curl script

Beitrag von sborkuti » 28.10.2018, 13:56

I want to access my Opop boiler through local network.
For example if I send from the pc the curl command:

Code: Alles auswählen

curl "http://192.168.0.103/user/cgi-bin/edition.cgi" -H "Authorization: Basic YnN6OjE3OTMxMzc5" -d "gt=664" -s
I get back back the response 664_3873.
I tried to write a script with curl or wget that would do the same thing and save my answer from the boiler to a variable, but every time I get a "false" response.
I wrote a ping script and I am getting response from the boiler.
Can anyone write me an example script, becauseI do not know if I am doing something wrong or is another problem.

Here is my script with curl:

Code: Alles auswählen

var url='"http://192.168.0.103/user/cgi-bin/edition.cgi"';
var cmd='"gt=664"';
var header='"Authorization: Basic YnN6OjE3OTMxMzc5"';
var comanda="/usr/local/addons/cuxd/extra/curl " # url # " -H " # header # " -d " # cmd # " -s ";
WriteLine(comanda);
WriteLine(dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State(comanda));
and the response:

Code: Alles auswählen

/usr/local/addons/cuxd/extra/curl "http://192.168.0.103/user/cgi-bin/edition.cgi" -H "Authorization: Basic YnN6OjE3OTMxMzc5" -d "gt=664" -s 
false
Zuletzt geändert von alchy am 29.10.2018, 07:36, insgesamt 2-mal geändert.
Grund: Code in Codetags posten

sborkuti
Beiträge: 10
Registriert: 14.10.2018, 13:31

Re: CCU2 Cuxd Curl script

Beitrag von sborkuti » 28.10.2018, 20:17

After other tests, if I execute the script:

Code: Alles auswählen

dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State("wget --http-user=bsz --http-password=17931379 http://192.168.0.103/user/cgi-bin/edition.cgi?gt=664");
dom.GetObject("CUxD.CUX2801001:1.CMD_QUERY_RET").State(1);
var v = dom.GetObject("CUxD.CUX2801001:1.CMD_RETS").State();
WriteLine(v);
apparently nothing happens, but if I restart the CCU2, in the folder /usr/local/addons/cuxd there is a file edition.cgi?gt=664 and inside the file is the text with the expected answer from the boiler.
Normally that answer should not be in the variable "var v" ?
Zuletzt geändert von alchy am 29.10.2018, 07:34, insgesamt 1-mal geändert.
Grund: Code in Codetags posten

Benutzeravatar
uwe111
Beiträge: 3702
Registriert: 26.02.2011, 22:22
Kontaktdaten:

Re: CCU2 Cuxd Curl script

Beitrag von uwe111 » 29.10.2018, 09:54

sborkuti hat geschrieben:
28.10.2018, 20:17

Code: Alles auswählen

dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State("wget --http-user=bsz --http-password=17931379 http://192.168.0.103/user/cgi-bin/edition.cgi?gt=664");
You forgot to redirect the HTTP response to STDOUT in your wget command line.

Try this:

Code: Alles auswählen

dom.GetObject("CUxD.CUX2801001:1.CMD_SETS").State("wget -O - --http-user=bsz --http-password=17931379 http://192.168.0.103/user/cgi-bin/edition.cgi?gt=664");
Alle sagten: Das geht nicht. Dann kam einer, der wußte das nicht und hat's einfach gemacht.
SPENDEN :wink: Download: CUxD 2.1.0, RFD-Monitor, Vellemann K8055, SSH KeyDir

sborkuti
Beiträge: 10
Registriert: 14.10.2018, 13:31

Re: CCU2 Cuxd Curl script

Beitrag von sborkuti » 29.10.2018, 17:44

Yes, that was the problem, thank you, now it works.
This means if we want to send a command where we do not expect a response we can use CURL, and if we wait for an answer we use GET.

Antworten

Zurück zu „HomeMatic - english“