OpenSprinkler Forums OpenSprinkler Unified Firmware Change %Watering via API call not working

This topic contains 7 replies, has 3 voices, and was last updated by  Ray 5 days, 17 hours ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #58507

    franzstein
    Participant

    I was wondering if the API call to change the %Watering is working at all?

    I have set the Weather Adjustment Method to “Manual” and the %Watering to 100%.

    Running the API call http://ipadress/cv?pw=mypassword&o23=77 results in {“result”:1}. However the %Watering Level does not change. It is still set to the % Watering (100%) setup before and has not changed to 77% as expected.

    A reboot of the OpenSprinkler does not help either.

    Any help would be appreciated.

    App Version: 1.8.4
    Firmware: 2.1.8
    Hardware Version: 3.0 -DC

    #58689

    franzstein
    Participant

    Sorry! Actually used the wrong API call “Change Controller Variables [Keyword /cv]” instead of “Change Options [Keyword /co]”. Unfortunately http://ipadress/cv?pw=mypassword&o23=77 gives no errror. The API call http://ipadress/co?pw=mypassword&o23=77 is working!

    #59429

    kdeuler
    Participant

    Hi Franz. I’m glad you got the API call working.

    I’d like to ask you how you make the API call. What I’d like to do is call the API 3 or 4 times a year via, say, a cron job, to change the water % setting according to the season. I’m somewhat familiar with making cron jobs, but I’m not sure how I’d create the file (that the cron job would run) that calls the API.

    Thanks in advance

    #59430

    kdeuler
    Participant

    …. Note. a while back suggested I’d somehow use the HTTP GET command, but I’m not sure how.

    #59433

    franzstein
    Participant

    I’m not familiar with cron jobs and have never used it. However, what I have found by web search is that you can use lynx for urls with parameters:

    lynx -dump “http://ipadress/co?pw=mypassword&o23=77”

    It is stated that lynx is available on all systems by default. The OS “mypassword” has to be entered MD5 hashed, see OS API Documents for details. The Weather Adjustment Method has to be set to “Manual”.

    Regards

    Franz

    #60328

    franzstein
    Participant

    I still have some problems with the API Change Options call. To change the water level I used the simple API call http://ipadress/co?pw=mypassword&o23=77. It is working, the water level changed accordingly and results in {“result”:1}!

    I now noticed that this command will also set the items NTP, DHCP and Logging to off. An important note in the OS Firmware 2.1.8 API Document describes this behaviour. I changed the API call to http://ipadress/co?pw=mypassword&ntp=1&dhcp=1&lg=1&o23=77 and thought this will solve the problem, but no success!

    The issue is also described in thread API – Change Options Command. According to Samer it should be solved with firmware 2.1.6, but it seems to be still or again present in firmware 2.1.8.

    I gave it several trials. However, the items NTP, DHCP and Logging are always set to off after running the API call.

    I don’t use the items Sensor 1 type, Sensor 1 option, Ignore Password or Special auto refresh, but probably they are also affected.

    Maybe I do something wrong? Help would be highly appreciated.

    #60355

    franzstein
    Participant

    OK. Just found out that I have to use the idx parameter names in the API call. The correct call is: http://ipadress/co?pw=mypassword&o2=1&o3=1&o32=1&o23=77. The API Document isn’t so easy to understand? However, looking at it after some time again provides the solution for me.

    I hope that this is at least an example for others on how to change the water level via the OS API call without any side effects.

    #60432

    Ray
    Keymaster

    Yes you have to use the indexed parameters — the firmware was built up from an early version when OS was based on ATmega328 mcu with only 32KB flash and 2KB ram. As a result, a lot of the design decisions have to be centered around optimizing the code size. So the option parameters were not parsed using human readable names but rather indices. If we had OS 3.0 hardware to begin with, it would have been quite a bit easier without so much low-level optimizations.

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

You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware Change %Watering via API call not working