- Posted on
Sun May 11, 2014 5:28 pm
-
wikner
offline
-
- Posts: 181
- Joined: Nov 02, 2003
You're welcome. I have some additional comments about the Python API for the sprinklers which might be of use to others. I don't know if I should post them here or somewhere else; please redirect this to the appropriate place if necessary.
I was looking for a mechanism to detect whether a running schedule is paused, or whether the schedule is finished. I want to be able to detect both. It is clear that Indigo knows this, as it shows up in the UI. The UI even shows how much time is left in the current zone within which it is paused. There is no direct call to determine the paused state, but I found a way to detect it. I can trigger off of Active Zone Name Becomes Equal to 0. If the sprinkler is paused, indigo.devices[<sprinklerID>].activeZone will return None, whereas indigo.devices[<sprinklerID>].zoneScheduledDurations will return a non-empty list. On the other hand, if the sprinkler has run off the end of its schedule, then activeZone will also return None, but zoneScheduledDurations will return an empty list.
There is still no direct way to find out what zone in the schedule was running when the pause occurred, nor to query how much time is left in that zone; however, if I start the schedule from a Python script I can record a time-stamp in an Indigo variable, then when the pause occurs, calculate the paused zone and time left in that zone from the soneScheduledDurations list.
Since this is a bit of a hack, my question is do you think this behavior will continue to work, or do you anticipate changing the zoneScheduledDurations behavior? Is there any chance you might add a direct method for querying the Paused state and the timeLeftInZone value?