@Andreas-Nilson try;
execute "curl -s ‘http://192.168.10.4:8181/tcl.exe?x=dom.GetObject (‘presence test’). State (1)’”
Open URL if
@Andreas-Nilson try;
execute "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 try;
execute “curl -s ‘http://192.168.10.4:8181/tcl.exe?x=dom.GetObject (‘presence test’). State (1)’ > /dev/null”
Also, everything inbetween the first and last " is the terminal command. You have added > /dev/null AFTER the last ", thats a no go
Okay.
Could not find an provider that provides the next action of execute “curl -s ‘http://192.168.10.4:8181/tcl.exe?x=dom.GetObject(‘Anwesenheittest’).State(1)’> /dev/null”
@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"
@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
https://forum.pimatic.org/topic/1179/how-to-post-code-snippets-and-alike-on-the-forum
Hello, excuse me, that I am so bad to understand. I have now made a 1 to 1 copy.
http://www.bilder-upload.eu/show.php?file=22a74f-1499690445.jpg
http://www.bilder-upload.eu/show.php?file=a7979b-1499690502.jpg
@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 'presence test'
versus '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"
See also https://forum.pimatic.org/topic/1179/how-to-post-code-snippets-and-alike-on-the-forum