OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Interval plugin: Auto-Program – v2 release now available!
- This topic has 34 replies, 9 voices, and was last updated 9 years, 9 months ago by scottsh.
-
AuthorPosts
-
August 11, 2014 at 11:29 pm #27025
fbretMemberSo I did a little instrumentation of the python code:
print “ap zone”, str(z),” needs “, water_needed, ” – duration “, duration,”s”
if duration < MIN_DURATION: continue # don't water too little
duration *= gv.sd/100 # modify duration by water level if set
if gv.sd: # sequential mode
gv.rs[z][RS_STARTTIME] = accumulate_time
gv.rs[z][RS_DURATION] = int(duration) # store duration scaled by water level
accumulate_time += int(duration)
gv.rs[z][RS_STOPTIME] = accumulate_time
accumulate_time += gv.sd # add station delay
gv.rs[z][RS_PROGID] = autoPid # store program number for scheduling
gv.ps[z][PS_PROGID] = autoPid # store program number for display
gv.ps[z][PS_DURATION] = int(duration)
print “ap zone”, str(z),” starting “,gv.rs[z][RS_STARTTIME], ” – duration “, duration,”s – end itme:”,accumulate_timeThe output is then:
pi@sprinkler ~/OSPi $ sudo python ospi.py
sudo: unable to resolve host sprinkler
Setting water level to 90%
2014-08-11 Getting rainfall history…
auto_program: job scheduled runAutoProgram (trigger: cron[hour=’5′, minute=’0′], next run at: 2014-08-12 05:00:00)
plugins loaded:Starting timing loop
http://0.0.0.0:8080/
192.168.1.20:59181 – – [11/Aug/2014 16:16:49] “HTTP/1.1 GET /auto” – 200 OK
auto_program starting automatic program loop
ap zone 0 needs 0.5 – duration 1200.0 s
ap zone 0 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 1 needs 0.5 – duration 1200.0 s
ap zone 1 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 2 needs 0.5 – duration 1200.0 s
ap zone 2 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 3 needs 0.5 – duration 1200.0 s
ap zone 3 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 4 needs 0.5 – duration 1200.0 s
ap zone 4 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 5 needs 0.5 – duration 1200.0 s
ap zone 5 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 6 needs 0.5 – duration 1200.0 s
ap zone 6 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 7 needs 0.5 – duration 1200.0 s
ap zone 7 starting 1407774056 – duration 0.0 s – end itme: 1407774056Why is duration set to 0? It seems
duration *= gv.sd/100 # modify duration by water level if set
Further debugging shows water level = 90…
so I changed the line to:duration *= 1.0*gv.sd/100
issue looks fixed now… 🙂
August 11, 2014 at 11:57 pm #27026
scottshParticipantOh wow thanks – obviously that bug is caused by interaction between the other plug-in that I haven’t touched in a while. I kept having a problem where the Monthly Adjust plug-in was resetting itself so I quit using it. I didn’t get back to it post 2.0.
Obviously there is a type problem there with float/int. All part of the fun with weakly-typed languages :).
Fixed and committed.
Thanks a lot for helping get to the bottom of this!
Scott
August 13, 2014 at 2:19 pm #27027
scottshParticipantI realized this morning in the shower how to fix the implementation of the Monthly Adjust to Auto-Program that was previously bogus. It is fixed now – pull a new copy if you want these two plug-ins to work properly together.
For those who want to know what was up: the previous implementation modified the duration of the watering schedule by the monthly adjustment similar to how the manual program mode works. However, Auto-Program is “smarter” than manual mode, and as a result would automatically compensate back the other way, removing the adjustment! Why? Because Auto-Program recalculates the amount needed every day based on the actual watering time + any rainfall. This allows the code to include any manual mode watering, regular programs that you still want to run, etc. in the calculations for the next watering cycle. Subtle, I know, but it shows the power of this method of automation.
But enough about all of that, its fixed now so all is good.
Scott
August 13, 2014 at 4:04 pm #27028
richpuchParticipantPrior to you fixing the Monthly Audustment, my setting where all at 100% and now are:
[39, 50, 66, 82, 95, 96, 100, 93, 77, 53, 38, 33]
I don’t quite understand how this plugin works, are the values calculated automatically from wunderground or are these setting we need to adjust according to our environment? I do see during the ‘git pull’ the data/levels.json gets coppied down, so I assume these are your setting.
Thanks
RichAugust 13, 2014 at 4:38 pm #27029
scottshParticipantYeah those are my settings, if you copy over the data file from your previous install it will copy your old data if you have it.
My .json file shouldn’t really be in the repo, I’ll figure out a way to use his (initial, blank) copy.
October 11, 2014 at 9:14 pm #33633
eecycloneParticipantScottsh, have you updated this plugin at all or done any testing with the new 2.1.2 software?
January 5, 2015 at 5:57 pm #35149
scottshParticipantNo, I have not. The number of changes required was significant and I just honestly didn’t have the motivation to make time to do it. Â But, I’m getting fired up about it again.
I’m going to pull down Dan’s latest code and see how much work it really is.
January 6, 2015 at 2:15 pm #35158
Dan in CAParticipantScott,
Glad to see you are still involved!
I am planning to push an update in the next couple of days. It includes support for multiple languages and a new signalling system which allows events in the core program to trigger functions in plugins without polling (no looping required).
At this point I expect the code to remain fairly stable for the foreseeable future except for feature updates such as the ability to schedule multiple zones in each program.
Dan
January 7, 2015 at 8:26 am #35164
Rudolph TerblancheParticipant+1 on the multiple zones in each program.
January 7, 2015 at 2:53 pm #35165
scottshParticipantThanks for the note Dan – I’ll hold off until you release that update.  I pulled down the current code and started reviewing it so I could understand where the changes will be.
Scott
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Interval plugin: Auto-Program – v2 release now available!