OpenSprinkler › Forums › Third-Party Software › Using the OpenSprinkler API to schedule an ad-hoc program
- This topic has 8 replies, 5 voices, and was last updated 4 years, 5 months ago by Sven.
-
AuthorPosts
-
June 21, 2018 at 6:36 pm #50788
timcharperParticipantHi!
I developed the integration for OpenSprinkler and Homekit: https://www.npmjs.com/package/homebridge-opensprinkler . I’d like to make it so that if you manually enable multiple valves, in queues them up in sequence, rather than concurrently. Presently I’m using the manual program with an API call per valve. Apple Home doesn’t give you an option to turn on multiple valves in a single transaction so it needs to be done in sequence. Ideally, an interaction like this would be supported:
1) User taps Turn on Valve 3 for 20 minutes
2) Valve 3 turns on
3) User taps Turn on Valve 2 for 20 minutes
4) Valve 2 queues up to run after Valve 3 is done
5) User taps Turn on Valve 1 for 15 minutes
6) Valve 1 queues up after the last queued valve (valve 2)
7) User cancels valve 2
8) User queues up Valve 4 for 30 minutes
9) Valve 4 queues up after valve 1Basically, what I think I need is the ability to schedule a run-once program, with custom durations and start times, and also to be able to modify the program without stopping the existing valve from running.
If needed, I could do the scheduling in Homebridge plugin itself, instead, but this is a little less ideal as the user would not be able to cancel or see the program in the OpenSprinkler app. So if I can interact with the API and support the above interaction then that would be ideal.
Advice?
Thank you!
June 28, 2018 at 8:19 am #50872
SamerKeymasterThis is great work, thank you very much for your contribution!! I will try to get this installed soon to test it out 🙂
July 8, 2018 at 1:43 am #51015
RayKeymaster@timcharper: thanks for sharing your work. If your zones/stations are ‘sequential’ (which is so by default), then when you use the manual program API call, it automatically queues all the stations. Basically the scheduler makes sure the ‘sequential’ attributes are obeyed. What this means is that it you manually turn on zone 1, then zone 2, and so on, zone 2 will be pushed to the queued and will only run after zone 1 finishes.
July 9, 2018 at 1:11 pm #51045
timcharperParticipant@Ray – This is not what I’m seeing. All valves are turning on simultaneously. I’m running firmware 2.1.6 with hardware version 2.3.
Maybe I’m not using “manual program API call”? The URI I am using is “/cm?sid={n}&en=1&t={t}”.
July 9, 2018 at 3:09 pm #51050
timcharperParticipantAfter updating the firmware, I’m still seeing them turn on in parallel:
Attachments:
July 9, 2018 at 3:15 pm #51052
timcharperParticipantIt looks like an API endpoint was added to manually trigger a program. That would work sufficiently, although it is a bit less natural to use from the Home app.
July 17, 2018 at 2:54 pm #51178
RayKeymasterI checked the source code and I am pretty sure the /cm API observes sequential property of each zone:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/server.cpp#L1629
as you can see, it calls the “schedule_all_stations” function, which is here:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/main.cpp#L1047
and it definitely distinguishes between sequential and parallel. Are you sure your zones are all sequential? In any case, you are right that manually trigger a program run is now also part of the API.September 19, 2018 at 5:48 am #52711
slothParticipantThis is awesome! Thanks!
April 11, 2020 at 5:01 pm #65107
SvenParticipantHi,
just testing your plugin which runs fine. Thanks for this!
One thing I was wondering is, if there is a possibility to have an appearance like on the Rachio Homekit integration:
Regards
Sven -
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Third-Party Software › Using the OpenSprinkler API to schedule an ad-hoc program