The - options need to be concatenated like curl -sH
or do a curl -H --silent
-
[Solved]Trying to execute a shell command but I get an error
-
@Harry-van-der-Wolf said:
curl -sH
Thanks for clearing that up, but now I get this:
"10:21:14.197 [pimatic] rule regel-hue-aan error executing an action: Command failed: 10:21:14.222 [pimatic] Error on evaluation of rule condition of rule regel-hue-aan: Command failed: 10:21:18.105 [pimatic] rule hue-uit error executing an action: Command failed: 10:21:18.122 [pimatic] Error on evaluation of rule condition of rule hue-uit: Command failed: "
-
Just to make sure: Can you please share the complete rule/command like you have it now?
Edit (after priv chat):
"execute \"curl -H \"Accept: application/json\" -X PUT --data '\{ \"on\": true \}' http://philips-hue.local/api/newdeveloper/groups/0/action\""
-
@Harry-van-der-Wolf said:
"execute \"curl -H \"Accept: application/json\" -X PUT --data '\{ \"on\": true \}' http://philips-hue.local/api/newdeveloper/groups/0/action\""
i quoted a similar proposal a few threats above.
does it work with the escaped at the beginning " and end of the curl command now?i am recommending Escape for JSON to make escapes much mire easier!
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
Guys, this is confusing. If I understood @Frank-Buurlage right the proposal I have posted in http://forum.pimatic.org/topic/1015/trying-to-execute-a-shell-command-but-i-get-an-error/11 basically works, but results in the log output of curl transfer staticstics. This can be omitted with the -s option.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig No unfortunately it does not work, nothing happens
So this command works in terminal
curl -H "Accept: application/json" -X PUT --data '{"on":true}' http://philips-hue.local/api/newdeveloper/groups/0/action
When I use the escape from JSON
"curl -H \"Accept: application/json\" -X PUT --data '{\"on\":true}' http://philips-hue.local/api/newdeveloper/groups/0/action"
Does not work
edit: It gives an error that it does not know what to do after execute
-
I don’t know why, but I got it working!
execute "curl -X PUT http://192.168.1.49/api/newdeveloper/groups/0/action -d '\{ \"on\":false}' -s"
thanks for all the help!
-
@Frank-Buurlage said:
I don’t know why, but I got it working!
That’s great
Strange, however, as I had to escape the closing curly brace when I tested on my system."It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
The escaping of the curly brackets in a rule is something that @sweetpi mentioned somewhere in all the treads as something pimatic requires. The “escape from json” tool doesn’t do that. That one works fine as such but you have to remember to use the extra curly brackets escaping in a rule.
-
@Frank-Buurlage so basically my command modified to your personal settings
But I’m glad you got it working now -
@Cryonic90 Yes it is but it is weird because the first time I tried it gave me an error!
-
That is indeed weird… But now you can play with it