Open URL if
Yes and what can one make that the error no longer comes?
The name of the .exe does not matter, you can also write x.exe. In the terminal my link works, only Pimatic has problem with ‘(’
I would like to switch to another system (HomeMatic CCU2 “EQ3”) a variable 1 is true 0 is false
This link in the terminal works right!
Curl -s “http://192.168.10.4:8181/tcl.exe?x=dom.GetObject (‘presence test’). State (1)”
Thank you for your help
error [pimatic-shell-execute]: [ShellActionHandler] Error: Command failed: curl -s ‘http://192.168.10.4:8181/tcl.exe?x=dom.GetObject (‘presence test’). State (1)’” > /dev/null
/bin/sh: 1: Syntax error: “(” unexpected
@Andreas-Nilson my man, i am giving you a copy and paste code. If you keep replacing characters in that code you wont get it to work!!
Copy and paste this line!!
EDITED (see post below)
execute "curl -s 'http://192.168.10.4:8181/tcl.exe?x=dom.GetObject('presence test').State(1)' > /dev/null"
This post is deleted!
@Andreas-Nilson Your posts are difficult read. Moreover, note, if you include code or command sequences without backticks in your posts some characters will get translated by the editor, e.g. the normal straight double quote will get translated to opening and closing double quotes which are different characters. Same applies for single quotes and it may even add extra spaces. This way it is not possible to copy/paste snippets from the posts as the command shell won’t recognize the opening and closing double quotes.
" versus “ and ”, ' versus ‘ and ’@Gleno0h this also applies to your posts! I have already corrected it in your last post
Hello, excuse me, that I am so bad to understand. I have now made a 1 to 1 copy.
@Andreas-Nilson Well, that’s probably as issue with application server. Are you able to trace error messages on the server side?
Another point: What’s about
'Anwensenheittest'? Does this make no difference?
Another problem may be that curl does not automatically encode URL characters as one might expect (brace and spaces as part of the URL path need to be provided as escape character sequences). Therefore, my suggestion is to encode these characters as shown in the example below.
I have tested the following with a fake server:
# rule action as entered in the pimatic rule editor execute "curl -s 'http://localhost:4444/tcl.exe?x=dom.GetObject(%27presence%20test%27).State(1)' > /dev/null" # Fake server and message received pi@raspi3:~ $ nc -k -l 4444 > filename.out ^C pi@raspi3:~ $ cat filename.out GET /tcl.exe?x=dom.GetObject(%27presence%20test%27).State(1) HTTP/1.1 User-Agent: curl/7.38.0 Host: localhost:4444 Accept: */*
EDIT: https://unix.stackexchange.com/questions/86729/any-way-to-encode-the-url-in-curl-command suggests using option ‘–data-urlencode’ along with ‘-G’ to get query part of the URL encoded. As part of this I noticed the opening and closing brace gets encoded too, but I don’t this it is necessary as only unreserved chars need to be encoded in that part of the URL. See also https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters
# rule action as entered in the pimatic rule editor execute "curl -s -G 'http://localhost:4444/tcl.exe' --data-urlencode 'x=dom.GetObject(\"presence test\").State(1)' > /dev/null" # Fake server and message received pi@raspi3:~ $ nc -k -l 4444 > filename.out ^C pi@raspi3:~ $ cat filename.out cat filename.out GET /tcl.exe?x=dom.GetObject%28%22presence%20test%22%29.State%281%29 HTTP/1.1 User-Agent: curl/7.38.0 Host: localhost:4444 Accept: */*
I thank you for your effort, Super helpful forum. Sorry for the bad communication!
[qoute]execute “curl -s -G ‘http://192.168.10.4:8181/tcl.exe’ --data-urlencode ‘x=dom.GetObject(“presence”).State(1)’ > /dev/null”[\qoute]
Works perfect 👍
@Andreas-Nilson That’s great! You’re welcome!
… and please consider https://forum.pimatic.org/topic/1179/how-to-post-code-snippets-and-alike-on-the-forum for furture posts. Thanks
EDIT: … actually, the command string you sent in you last post does not work! Maybe you can fix that, eventually.
‘’’ execute “curl -s -G ‘http://192.168.10.4:8181/tcl.exe’ --data-urlencode ‘x=dom.GetObject(“presence”).State(1)’ > /dev/null” ‘’’
Hopefully it works now.
EDIT: You need to use backticks!!! See corrected line below. As you see above
\"is rendered as some opening or closing double quote, otherwise.
execute "curl -s -G 'http://192.168.10.4:8181/tcl.exe' --data-urlencode 'x=dom.GetObject(\"presence\").State(1)' > /dev/null"