OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Change %Watering via API call not working
Tagged: OS API Change Options
- This topic has 7 replies, 3 voices, and was last updated 5 years, 3 months ago by Ray.
-
AuthorPosts
-
March 11, 2019 at 8:37 am #58507
franzsteinParticipantI 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 -DCAttachments:
March 11, 2019 at 12:38 pm #58689
franzsteinParticipantSorry! 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!
March 22, 2019 at 9:57 pm #59429
kdeulerParticipantHi 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
March 22, 2019 at 9:59 pm #59430
kdeulerParticipant…. Note. a while back suggested I’d somehow use the HTTP GET command, but I’m not sure how.
March 23, 2019 at 4:06 am #59433
franzsteinParticipantI’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
May 14, 2019 at 4:15 am #60328
franzsteinParticipantI 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.
May 15, 2019 at 4:32 am #60355
franzsteinParticipantOK. 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.
May 16, 2019 at 6:17 am #60432
RayKeymasterYes 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.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Change %Watering via API call not working