OpenSprinkler Forums OpenSprinkler Unified Firmware Enable/disable program through API

This topic contains 10 replies, has 3 voices, and was last updated by  Ray 2 days, 3 hours ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #61726

    MantasJ99
    Participant

    Hello,

    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.

    #61728

    Ray
    Keymaster

    Assuming 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.

    #61733

    MantasJ99
    Participant

    Thank 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?

    #61737

    Ray
    Keymaster

    Please 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.

    #61748

    MantasJ99
    Participant

    Thank 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?

    #61765

    Ray
    Keymaster

    The value of o31 is integer: 0 means manual, 1 is zimmerman, and 2 is auto rain delay.

    #61784

    MantasJ99
    Participant

    Wonderful, thanks!

    #62078

    franzstein
    Participant

    Hello 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?

    #62109

    Ray
    Keymaster

    result: 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.

    #62110

    franzstein
    Participant

    There 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:
    #62173

    Ray
    Keymaster

    If 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.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware Enable/disable program through API