OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Enable/disable program through API
Tagged: API Program Enable Disable
- This topic has 10 replies, 3 voices, and was last updated 5 years ago by Ray.
-
AuthorPosts
-
July 18, 2019 at 7:15 am #61726
MantasJ99ParticipantHello,
I have a question about OpenSprinkler API. I know that it is possible to enable/disable programs through API, but here is the situation. I only need to enable/disable programs that are already created and I don’t need anything else. How the API command should look like for this case?
Thank You.
July 18, 2019 at 9:25 am #61728
RayKeymasterAssuming you are running firmware 2.1.8, you can use the change program (/cp) API to enable or disable an existing program. This is not yet documented in the API document, but it’s in the firmware code:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/server.cpp#L993
for example:
http://x.x.x.x/cp?pw=xxx&pid=x&en=0
will disable the program whose index is given by pid.July 19, 2019 at 1:19 am #61733
MantasJ99ParticipantThank You for Your answer. Yes, indeed that is exactly what I needed and it works perfectly, but now I face another problem. I use API to disable/enable zones and disable/enable rain dependency on each zone. This is syntax that I use: http://ip/cs?pw=password&d0=1 or http://ip/cs?pw=password&i0=1 and this is working fine for zone1, but if I instead use: http://ip/cs?pw=password&dX=1 or http://ip/cs?pw=password&iX=1 where X is from 1 to 7, it does nothing, so the commands work only for the first zone, where could the problem be?
July 19, 2019 at 7:07 am #61737
RayKeymasterPlease check the API document carefully. For this API, d0 sets the disable bits of the first 8 zones, not just the first zone. d1 sets the next 8 zones and so on. Each value is in the range of 0 to 255 representing the bit field of a set of 8 zones.
July 19, 2019 at 2:57 pm #61748
MantasJ99ParticipantThank You again, I will try this next week. I have another question: what should I write in API to change weather method to zimmerman? Right now I use: os-ip/co?pw=password&o31=manual and os-ip/co?pw=password&o31=zimmerman –> The first one with manual works, but zimmerman doesn’t, how do I do this?
July 19, 2019 at 5:15 pm #61765
RayKeymasterThe value of o31 is integer: 0 means manual, 1 is zimmerman, and 2 is auto rain delay.
July 19, 2019 at 11:28 pm #61784
MantasJ99ParticipantWonderful, thanks!
August 10, 2019 at 2:40 am #62078
franzsteinParticipantHello Ray,
I have tried to use the change program (/cp) API to enable or disable an existing program. Unfortunately, it does not work as described. The error returned is {“result”:16} Data Missing (e.g. missing required parameters). Details are:
Get Program Data via http://x.x.x.x/jp?pw=xxx results in:
{“nprogs”:2,”nboards”:1,”mnp”:35,”mnst”:4,”pnsize”:16,”pd”:[[51,1,2,[420,0,0,0],[1800,1800,1800,0,0,0,0,0],”Summer 2019″],[50,1,2,[16474,0,0,0],[600,600,600,0,0,0,0,0],”Hot Summer 2019″]]}
Enable program via http://x.x.x.x/cp?pw=xxx&pid=1&en=1 results in:
{“result”:16}
App Version: 2.0.3, Firmware: 2.1.8, Hardware version: 3.0 – DC
Any ideas?
August 12, 2019 at 6:03 am #62109
RayKeymasterresult: 16 means some data is missing:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/server.cpp#L93
I am not quite sure why you are getting this return value. You said your firmware is 2.1.8, but do you see a minor revision, like 2.1.8 (3) is minor revision 3? I could be that you are on an earlier minor revision of 2.1.8 that doesn’t support the en= parameter in /cp.August 12, 2019 at 8:25 am #62110
franzsteinParticipantThere is no minor revision shown in the About information. Is there another way to check the firmware details? I think I will wait for the 2.1.9 firmware release to update my OpenSprinkler. I don’t need the feature to enable or disable an existing program right now. But it is good to know that it will be at least available with the latest 2.1.8 firmware release.
Attachments:
August 16, 2019 at 2:56 pm #62173
RayKeymasterIf it doesn’t show any minor revision number, then it’s likely you have minor revision 0, which probably didn’t implement this API. Firmware 2.1.9 should be ready soon, we’ve finished the bulk of the implementation and just finishing up UI implementation and doing final testing.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Enable/disable program through API