OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Start a program via API
- This topic has 8 replies, 5 voices, and was last updated 8 years, 8 months ago by Ray.
-
AuthorPosts
-
December 17, 2015 at 10:59 am #41029
georgetarmitageParticipantWe use our irrigation system for frost protection in the orchard. The system will run for a minute in each block on the local weather station sensing a temperature of one degree. Our water comes from a bore so is just warm enough to stop frost settling. Once the weather station senses two degrees it stops the irrigation system. Current controller has a set of contacts to start and stop the program.
I can set up a program in Opensprinkler to run 1 min in each of the blocks and then repeat 1000 times. But I need to be able to start, and stop, this program preferably via HTTP API.
I am running a Windows PC that interfaces with weather station and then runs WUHU.
Any thoughts anyone…? Thanks in advance!
December 17, 2015 at 4:29 pm #41035
DaveCParticipantThe API provides a way to run a program but not a pre-defined named program. See Section 16. Start Run-Once Program of the API manual. Essentially Run-Once Program allows you to specify a list of zones to run with their duration.
What I’ve done (and I think the UI and App do something similar for ‘Quick’ programs) is to maintain a list of all the programs and the zone defs for them. When a user wants to manually run the program called ‘Front Lawn Zones’, I take the program definition and turn it into the format required by the Run-Once Program command. In my home use I define a set of manual run programs for this purpose as they are often somewhat different from the programs I’ve defined for scheduled runs.
Suggestion to Ray: Allow a PID or a Program Name to be given to the run-once program command (in the API) as another way to specify a program to run. OS already has the info, why make the programmer make the translation. It would also be nice if Manual was a ‘Type’ of a program to distinguish it from Interval or Weekly when that is its sole purpose. More obvious from a User’s perspective. And one more thing, while I’m on a role, if you decide to allow run-once manual to accept a PID, then that PID show up as the active program, not 254.
HTH
DaveDecember 21, 2015 at 1:57 am #41047
georgetarmitageParticipantI tried the run once but it doesn’t allow for a repeat. We need to do a minute in each block of the orchard until the temperature comes up again. I am going to try a script that creates a new program with a start time of five minutes ago. Then another that goes in and deletes that program.
I will post about success or otherwise!
December 21, 2015 at 7:24 am #41048
WokkeltjeParticipantI like the idea to be able to start a program using an API call.
Why I would use it.
I want to control my garden lights using OS, this will also be the light on the driveway and front door (this program will run from sunset till 11pm with my other feature request 🙂 ).
Now it would be nice to be able to use a shortcut on my phone to be able to manually start (in case I return home very late and the garden lights are already put out) that program for let say 15 minutes without needing to open the complete OS app, select the program and start it.tnx
December 21, 2015 at 9:56 am #41051
DaveCParticipantRe: georgetarmitage
I’ve never used WUHU but in a very quick look I see that it has the ability to create web pages. I wonder if you can use this capability to emit a run-once program command with all the zones that you want for 1 minute each and repeat this action in WUHU until the temp is OK.While it doesn’t help you now I think your usage need provides a good feature suggestion that would useful in other cases.
Suggestion to Ray: Provide the ability to create a program with type ‘Manual’. That type of program allows setting zone run times and additional start times (both fixed and repeating). It has all the attributes to describe what to do when triggered manually. It could be triggered from the API via Run-Once Program by supplying the PID or the Program Name. It could be triggered by the existing UIs in a similar way to Quick Programs.This capability would be generally useful early or late in the watering season where you could manually kickoff a program when you need it.
December 21, 2015 at 9:56 am #41052
DaveCParticipantRe: Wokkeltje
I haven’t tried it but you might be able to create a ‘short-cut-like’ browser reference with the Manual run command you want an start your lights. Starting that browser instance would emit the command that you want. There are also ‘http requester’ mobile apps that might do this in a cleaner way.December 21, 2015 at 11:07 am #41053
dun4cheapParticipantYou can definitely do something using the api.
December 22, 2015 at 3:04 am #41062
WokkeltjeParticipanttnx, found a way using the API to start my gardenlights.
1 important thing I found: most online MD5 hash convertors to convert the password gave me uppercases instead of the needed lower cases.
December 22, 2015 at 11:28 pm #41071
RayKeymasterYou can start a station through API call (using either /cm or /cr command) but starting a program is currently not supported. As mentioned above, the work-around is to call /jp to get program data (specifically station’s run times) and then issue a /cr to run stations according to any chosen program. This is how the app implements the ‘start this program manually’ feature.
I agree it’s useful to add API support to start a program, and will consider this for the next firmware.
Actually starting a program is currently supported by using buttons (long press B3). This exists because often people want landscapers to be able to start a program on the controller using buttons without having to give them web access to the controller.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Start a program via API