|
Page 1 of 2
|
[ 30 posts ] |
Go to page: 1, 2 Next |
| Author |
Message |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 EZFlora Operating Status
I'm building a Control Page to remotely operate the EZFlora Irrigation Controller via Indigo Touch. It's coming along nicely, but I've hit a snag. I cannot determine the current operating mode of the EZFlora beyond the basic "which zone is on". Specifically, I'd like to know if a Schedule is currently running or paused, or if no schedule is currently running. I'd also like to know the scheduled run times for each zone. I realize that the Schedule is handled directly by Indigo and not by the EZFlora itself, but Indigo does not make the current status (running, paused, stopped) or the scheduled run times available via AppleScript -- at least not as far as I can tell. So, I tried to use a few Triggers to update a variable that would then indicate the current status. However, the 2 Triggers pictured below NEVER fire -- even when the tested values for "Active Zone Name" appear on the Control Page exactly as entered in the Trigger dialogs below:   On the other hand BOTH of these similar Triggers fire reliably as expected:   Is there a trick I've overlooked, or am I out of luck?
|
| Wed Mar 16, 2011 9:32 am |
|
 |
|
matt (support)
Site Admin
Joined: Jan 27, 2003 Posts: 11689 Location: Texas
|
 Re: EZFlora Operating Status
Yeah, unfortunately, there isn't a way to trigger off those states. I'll look into adding a new mode sub-state for a future version of Indigo though.
_________________
|
| Wed Mar 16, 2011 9:43 am |
|
 |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 Re: EZFlora Operating Status
support wrote:Yeah, unfortunately, there isn't a way to trigger off those states. I'll look into adding a new mode sub-state for a future version of Indigo though.
That'd be great -- Thanks! In the meantime, I think I'll try this: Create a Control page that does nothing but display the "Active Zone Name". Then when I need the current status, use curl via AppleScript and parse the page's HTML for the displayed value of "Active Zone Name". That's the way McGyver would have done it... I think. I'll give it a try and report back.
|
| Wed Mar 16, 2011 9:55 am |
|
 |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 Re: EZFlora Operating Status
Follow up: It's definitely not going to win any awards for elegance, but it works. Here's the Control Page in Indigo's Control Page Editor with the lone item selected:  I use this Trigger to execute the (external) AppleScript below:  The AppleScript simply uses curl to load the Control Page, and extract the status string from the resulting HTML. It then changes the first letter of every word to upper case, and sets the value of an Indigo variable named "sprinklerStatus" to the resulting string. - Code: Select all
property userName : "yourUserName" -- your Remote Indigo Server user name property thePassword : "yourPassword" -- your Remote Indigo Server user name
set theStatus to my getSprinklerStatus() if theStatus does not start with "ERROR:" then my setIndigoVar("sprinklerStatus", theStatus, true) end if
on getSprinklerStatus() --returns the value of the pseudo-property "Active Zone Name" for an EZFlora Irrigation Controller --requires a Control Page called "Sprinkler System Status" on which the only displayed item is the Device State of the EZFlora's Active Zone Name set theStatus to "Unknown" try set theCommand to "curl --digest http://" & userName & ":" & thePassword & "@127.0.0.1:8176/controlpage?name=Sprinkler%20System%20Status" set theResult to do shell script theCommand set theBeginning to the offset of "<a href=\"#\" onclick=\"controlElement(0);" in theResult set theEnding to (the offset of "</div>" in (text theBeginning through -1 of theResult)) + theBeginning + (length of "</div>") set parsedDiv to text theBeginning through theEnding of theResult set {TID, text item delimiters} to {text item delimiters, " "} set theStatus to titleCase((every word of removeMarkup(parsedDiv)) as text) set text item delimiters to TID return theStatus on error errMsg number errNum set theStatus to "ERROR: " & (errMsg & " (" & errNum as text) & ")." end try return theStatus end getSprinklerStatus
on removeMarkup(this_text) --returns a string containing 'this_text' without the markup tags --(defined as anything between a '<' character and a '>' character --source: http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.04.htm#1000 try set globalErrorMessage to "" set copy_flag to true set the clean_text to "" repeat with this_char in this_text set this_char to the contents of this_char if this_char is "<" then set the copy_flag to false else if this_char is ">" then set the copy_flag to true else if the copy_flag is true then set the clean_text to the clean_text & this_char as string end if end repeat return the clean_text on error errMsg number errNum set globalErrorMessage to makeErrMsg(errNum, errMsg) return "" end try end removeMarkup
on titleCase(theString) (* returns the supplied string with the first letter of each word in upper case, and all other letters in lower case adapted from: SmartString 1.7 Copyright 1994-2007 by Jon Pugh <jonpugh@frostbitefalls.com> Jon's Home Page <http://www.seanet.com/~jonpugh/> *) local newString, afterSpace, isALetter set newString to "" set afterSpace to true repeat with c in characters of theString set a to ASCII number contents of c if afterSpace then if a > 96 and a < 123 then set a to a - 32 set newString to newString & (ASCII character a) else set newString to newString & c end if set afterSpace to false else if a > 64 and a < 91 then set a to a + 32 set newString to newString & (ASCII character a) else set newString to newString & c end if end if if not ((a > 96 and a < 123) or (a > 64 and a < 91) or (a is in {39, 44})) then set afterSpace to true end repeat set theString to newString end titleCase
on setIndigoVar(thisVar, thisValue, thisDisplay) --sets and Indigo variable; creates it first if it does not exist --source: Weather NOAA sync.scpt that ships with Indigo 4 tell application "IndigoServer" if not (variable thisVar exists) then make new variable with properties {name:(thisVar), value:(thisValue), display in remote ui:thisDisplay} else if the value of variable thisVar is not thisValue then set value of variable thisVar to thisValue -- set the Indigo variable end if end if end tell end setIndigoVar
That's progress, but there's still more to do. Using this method does not allow me to distinguish between the two possible scenarios when the sprinkler system is running: A Schedule is running One of the following commands was issued: Activate Previous Zone, Activate Next Zone, Turn On A Specific Zone
And it does nothing to address run times for each zone. For these last two items, I hope to start experimenting with log entries that have been saved to an SQLite database. I should be able to get what I need from there. We'll see...
|
| Wed Mar 16, 2011 3:45 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
 Re: EZFlora Operating Status
I took a different approach to the irrigation management problem. Rather than using a fixed EZflora schedule, I created a separate Action Group for each sprinkler Zone. Attachment:
AG.png [ 56.46 KiB | Viewed 3887 times ]
As you can see, there is only one zone with an assigned time in each Action Group. For normal irrigation control, I then created a Time/Date Action for each zone (I.e. 1 per each Action Group.) I carefully set the times so that no two zones can ever be on at the same time. In this way, I can independently control each zone and water it as often, or infrequently, as necessary. Then, for manual control, I created this control page: Attachment:
irgCP.png [ 238.74 KiB | Viewed 3887 times ]
In this page each Icon represents the state of a Zone on a controller. The server action simply executes the Action Group for the selected zone, and sets a lock variable to true so the Time/Date action can't run if I have the system running on manual. Here is the Control Page in the editor: Attachment:
CPMGR.png [ 222.84 KiB | Viewed 3887 times ]
|
| Wed Mar 16, 2011 5:00 pm |
|
 |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 Re: EZFlora Operating Status
Nice! A very novel solution. I'll have to give some thought to the idea of completely taking over the scheduling from the EZFlora controller.
|
| Wed Mar 16, 2011 6:27 pm |
|
 |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 Re: EZFlora Operating Status
I'm hoping someone can save me the time and water required to figure these questions out the hard way: 1. What does the EZFlora do when you activate a zone directly (using "Activate Previous Zone", "Activate Next Zone", or "Turn On A Specific Zone") without running the Schedule? I know that the zone is immediately activated, but for how long? The maximum time programmed into the controller? Or is the variable "sprinklerDurationMultiplier" used to calculate the run time? Or does it run until it's shut off manually (I sure hope not!)?
2. And at the end of that time (assuming it shuts itself off), is the next zone activated or does the system simply stop?
3. If you change zones (with one of the above commands) while a Schedule is running, does the Schedule simply resume after the manually activated zone completes its cycle? And is the variable "sprinklerDurationMultiplier" used to calculate the run time for that zone?
|
| Thu Mar 17, 2011 12:00 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6651 Location: Austin, Texas
|
 Re: EZFlora Operating Status
1) It runs the previous schedule. It should never run past the max values.
2) It will continue to the next zone until it reaches the end.
3) Schedules are run sequentially, so it will continue the schedule until the end.
The multiplier will apply if the previously run schedule had the multiplier set.
_________________ Jay (Indigo Support)
|
| Thu Mar 17, 2011 6:04 pm |
|
 |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 Re: EZFlora Operating Status
Just what I needed -- thanks, Jay!
|
| Thu Mar 17, 2011 6:55 pm |
|
 |
|
hamw
Joined: Mar 31, 2008 Posts: 738
|
 Re: EZFlora Operating Status
Don't know if this would be helpful, but I used a different approach. I created a control page variable icon which is tied to the status of the EZFlora. When pressed it brings up the UI. A text variable above the sprinkler icon shows the active zone. So, if all zones are off, the icon is grey and "All Off" appears above. If the EZFlora is running, the icon turns green and the active zone name appears above. Pressing the icon shows the zones and the duration of the schedule.
I have several schedules set up as variables and time date actions. When a schedule is selected, the "SprinklersOn" variable is set to that schedule and the appropriate TDA fires as planned. This is why the "SprinklersOn" is reading "no" -- as it's the winter the sprinkler variable is currently set to be off so no schedules will run.
This approach has seemed to work so far. The TDAs fire action groups, so if I want to start a schedule independent of the timers, I can go to the Action Groups area of Indigo Touch and just press the appropriate schedule.
Attachments:
sprinkler examples.tiff [ 373.11 KiB | Viewed 2370 times ]
|
| Sun Mar 20, 2011 10:51 am |
|
 |
|
hamw
Joined: Mar 31, 2008 Posts: 738
|
 Re: EZFlora Operating Status
Just to be sure this thing was working like I said (did it this winter) I set "Sprinklers On:" to the "Lawns Only" schedule and changed the time so it would be executed automatically from Indigo. When it fired, the icon turned green and the first zone appeared above. Clicking the icon brought up the UI to show the programmed zones and durations. Pressing the stop button turned off the schedule and the icon went grey.
I think this would answer the questions in your second paragraph -- e.g. which schedule, is it active, and what are the durations -- with a minimum of hassle.
Attachments:
sprinkler examples 2.tiff [ 123.24 KiB | Viewed 2343 times ]
|
| Sun Mar 20, 2011 2:29 pm |
|
 |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 Re: EZFlora Operating Status
Very nice. Clearly there are lots of ways to skin this cat. hamw wrote:When pressed it brings up the UI.
What UI are you referring to? The Play/Pause/Next/Previous buttons? Is there a pre-designed version available, or did you roll your own? I wound up rolling my own -- and it's a deceptively complex task. For me, the distinction between manually watering individual zones and watering on a Schedule is important. And I was determined to be able to do it all using just my iPhone. No more hiking back and forth between the yard and the controller in the garage. Now I can control the whole thing FROM the yard. I still have a few minor details to work out, and additional Control Pages to add for things like editing the Schedule. But it's slowly coming together and so far, it works as planned. Schedule On, but not running; system idle:  Schedule On, but not running; Zone 3 watering manually:  Schedule On and running; Zone 3 currently watering:  Schedule Off; system idle: 
|
| Sun Mar 20, 2011 8:00 pm |
|
 |
|
hamw
Joined: Mar 31, 2008 Posts: 738
|
 Re: EZFlora Operating Status
Wow, that is a beautiful interface. Like you, my sprinklers are set to run at night. I figured that real time control would not needed, hence the pre-written schedules. However, your setup is so neat I might give it a try. Could you post the code and upload the buttons to the user contribution library?
The UI is simply the standard Indigo popup control panel that tells the schedule's zone durations and allows back/play/pause/forward. It comes up when the icon is pressed as a "popup UI control". AFAIK, there is no way to set individual sprinkler zone duration from Indigo Touch either through the popup UI control or the device interface, unless a custom interface like what you have created is made.
|
| Sun Mar 20, 2011 8:46 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
 Re: EZFlora Operating Status
hamw wrote:... AFAIK, there is no way to set individual sprinkler zone duration from Indigo Touch either through the popup UI control or the device interface, unless a custom interface like what you have created is made.
I could be wrong on this, since I haven't tried it. but... The Indigo AppleScript dictionary provides for the following action steps: sprinkler action runSchedule / stopSchedule / pauseSchedule / resumeSchedule / prevZone / nextZone / zoneOnzone index integer -- (use if sprinkler action = zoneOn) the zone index which should be turned on zone durations list of real -- (use if sprinkler action = runSchedule) list of zone durations to schedule So, you should be able to create a control page with a pair of up and a down arrows to set the an internal variable for the zone index, and another pair of arrows to set the zone duration. The arrow actions could be AppleScripts, which would allow high and low limits, or just simple action groups to increment/decrement a variable. Then, a final button would execute an AppleScript which would use the Zone and Duration values to start the EZFlora. I believe the trick is to set the durations for all zones other than the desired zone to 0. For example, if the desired zone was 2 and the zone duration was stored in variable target_duration, the value of zone durations would be {0,target_duration,0,0,0,0,0,0} CAVEAT: This is all just a guess. I have not tried using action steps and couldn't find any useful examples in the forums, so I can't really post any psuedo code. If anyone has actually tried this please speak up.
|
| Sun Mar 20, 2011 9:51 pm |
|
 |
|
raneil
Joined: Feb 11, 2011 Posts: 32 Location: Grapevine, Texas
|
 Re: EZFlora Operating Status
hamw wrote:Wow, that is a beautiful interface. Like you, my sprinklers are set to run at night. I figured that real time control would not needed, hence the pre-written schedules. However, your setup is so neat I might give it a try. Could you post the code and upload the buttons to the user contribution library?
Thanks. I don't mind sharing it, but it's all very customized for my needs. I'm not sure how I'd go about packaging it so that it would make sense and/or be useful to someone else. And I still have a few wrinkles to iron out. hamw wrote:The UI is simply the standard Indigo popup control panel that tells the schedule's zone durations and allows back/play/pause/forward. It comes up when the icon is pressed as a "popup UI control". AFAIK, there is no way to set individual sprinkler zone duration from Indigo Touch either through the popup UI control or the device interface, unless a custom interface like what you have created is made.
Well, so it is. I'm not sure how I missed that feature, but I did. Which makes me wonder how many other cool Indigo features I've overlooked. Another reason to haunt these Forums...
|
| Mon Mar 21, 2011 7:17 pm |
|
|
|
Page 1 of 2
|
[ 30 posts ] |
Go to page: 1, 2 Next |
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|