Automatically Set States via Tasker for Android (WORKING!)
Posted: Tue Aug 02, 2011 8:03 pm
This is more of a request, and process post than anything. I am trying to make a setup that once my cell phone (Android) connects to my WiFi at my house, it will tell Zoneminder to switch off some of the cameras via changing the Runstate of Zoneminder.
I have two profiles, one called "Away" and the other called "Home"
Tasker has the ability to Post a form via Http.
It would work properly, except that I have a login enabled. Currently, its appears there is no way to auto login via the URL alone. Here is what I have found so far:
From someone posting about auto logging in from a cell phone, where inserting this form into an HTML page will give you a button that will automatically log you in:
I also found that you can use the URL to change states:
I feel like I have two parts that can work together... but unable to see the connection. Any ideas? I'll keep researching and testing till I figure this one out.
And one more little bit that may help (from the Wiki:FAQ)
I have two profiles, one called "Away" and the other called "Home"
Tasker has the ability to Post a form via Http.
It would work properly, except that I have a login enabled. Currently, its appears there is no way to auto login via the URL alone. Here is what I have found so far:
From someone posting about auto logging in from a cell phone, where inserting this form into an HTML page will give you a button that will automatically log you in:
Code: Select all
<form name="loginForm" id="loginForm" method="post" action="http://yourIP/index.php" target="_blank">
<input name="action" value="login" type="hidden">
<input name="view" value="postlogin" type="hidden">
<table id="loginTable" class="minor" cellspacing="0">
<tbody>
<tr>
<td class="colRight"><input name="username" value="YOURUSERNAME" size="12" type="hidden"></td>
</tr>
<tr>
<td class="colRight"><input name="password" value="YOURPASSWORD" size="12" type="hidden"></td>
</tr>
</tbody>
</table>
<input value="ENTER" type="submit" >
</form>
Code: Select all
http://YOURIP/zm/index.php?view=state&action=&apply=1&runState=Away&newState=
And one more little bit that may help (from the Wiki:FAQ)
Now you can switch between these two states by selecting them from the same dialog you saved them, or from the command line from issue the command zmpkg.pl <run state>, for example zmpkg.pl Daytime.
The final step you need to take, is scheduling the time the changes take effect. For this you can use cron. A simple entry to change to the Daylight state at at 8am and to the nighttime state at 8pm would be as follows,
0 8 * * * /usr/local/bin/zmpkg.pl Daytime
0 20 * * * /usr/local/bin/zmpkg.pl Nighttime