Page 2 of 2
Re: Irrigation with multiple zones
Posted: Monday 18 April 2016 20:51
by woody4165
I thought that when launching an os.execute the execution was launched, but them the control return to the script.
It's not like this.
So since the irrigation.sh can last also for 30 mins, I modified it adding an " &" at the the end, so is going to launch and the script get back control.
In this way of course I can't get any response (if any) from the bash script.
Do you think is a good idea?
Re: Irrigation with multiple zones
Posted: Monday 18 April 2016 22:09
by Egregius
Let the script write to a logfile, or back to domoticz in a text device or a user variable.
You should (almost) always use & at the end of a bash command to let it continue.
Re: RE: Re: Irrigation with multiple zones
Posted: Monday 18 April 2016 22:36
by woody4165
Egregius wrote:Let the script write to a logfile, or back to domoticz in a text device or a user variable.
You should (almost) always use & at the end of a bash command to let it continue.
Thanks!
How can I write into an user variable from a bash script?
Re: Irrigation with multiple zones
Posted: Monday 18 April 2016 23:16
by Egregius
Wiki json api
Just curl the url.
Re: Irrigation with multiple zones
Posted: Tuesday 19 April 2016 7:40
by woody4165
Thanks Egregius
got the json to update uservariable.
I'm not good in bash, how can I get if a previous curl, updating a switch via json, was ok or not?
I see that it return
{
"status" : "OK",
"title" : "SwitchLight"
}
if it's ok
and
{
"status" : "ERR",
}
if not ok.
What should I check?
My actual curl command is
Code: Select all
curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$IDX_ZONE1&switchcmd=On" > /dev/null
Thanks
Re: Irrigation with multiple zones
Posted: Tuesday 19 April 2016 7:46
by Egregius
In
http://www.domoticz.com/forum/viewtopic ... 780#p83346 I check the OK status and there's also a if statement.
Re: Irrigation with multiple zones
Posted: Tuesday 19 April 2016 8:02
by woody4165
Nice. I will take a look in the afternoon!