OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Python interval program update 9/23/13
- This topic is empty.
-
AuthorPosts
-
September 24, 2013 at 5:50 pm #22651
Dan in CAParticipantThe September 23 2013 update to the Python Interval Program is now available on GitHub.
This is mostly a bug fix release, especially in the area of concurrent operation.
Added a new “revision” page to the native web interface.
Pointing your browser to [URL of the program]/rev will bring up a page with revision and date information.
for example on my test system it would be: 192.168.1.22:8080/revUp till now any running station would be stopped and scheduled stations would be cleared when the number of expansion boards was changed on the Options page.
This has been fixed and expansion boards can be added “on the fly” without interrupting a running program.See the Wiki for update instructions:
http://rayshobby.net/mediawiki/index.php?title=Python_Interval_Program_for_OSPi#Updating_the_programFrom the README:
Additions, bug fixes:
1. Added a new revisions page to the native web interface.
2. Modified the home.js file to show time zone info in the last run log near the bottom of the page.
3. Fixed a bug in concurrent mode that kept a station running after it’s duration had expired.
4. Fixed a bug that would cause an exception (freeze the program) after the number of expansion boards was changed.
5. Fixed a bug that would stop a running station and clear scheduled stations when the number of expansion boards was changed in Options.Files that were changed in this update:
ospi.py
OSPi/static/scripts/java/svc1.8.3/home.js
README.mdDan
September 26, 2013 at 3:14 pm #25582
dennyfmnParticipantHi Dan,
Thanks so much for adding the per station rain sensor option. That’s great! Plus all the other fixes and updates.
It took me a while to feel confident to do the “git pull” to bring in your commits and merge them with my local changes for the garage door and rain sensor. I’m new to git. I’ve been reading a really good on-line free book, http://git-scm.com/book, which has helped me quite a bit. http://genomewiki.ucsc.edu/index.php/Resolving_merge_conflicts_in_Git also helped with understanding what I needed to do to fix the conflicts I had in ospi.py and home.js.
Since the rain sensor is functional now, I wonder if you would consider adding code to ospi.py to define the pin, set up the gpio, read the pin, and poll it.
Here’s the way I’ve done it, adding to the appropriate sections:
def getRainState():
if GPIO.input(pin_rain_sense):
res2 = 0
else:
res2 = 1
return res2
pin_rain_sense = 25
GPIO.setup(pin_rain_sense, GPIO.IN, pull_up_down=GPIO.PUD_UP)
And inserting a call to get the rain sensor state in the main loop:
def main_loop(): # Runs in a seperate thread
""" ***** Main algorithm.***** """
print 'Starting main loop n'
last_min = 0
while True: # infinite loop
gv.sd=getRainState()
gv.now = time.time()+((gv.sd/4)-12)*3600 # Current time based on UTC time from the Pi adjusted by the Time Zone setting from options. updated once per second.
Other folks might choose a different input pin for the rain sensor, but the rest of the code would be there.
[attachment=1:2ozylmh5]Update-20130926.JPG[/attachment:2ozylmh5]
[attachment=0:2ozylmh5]StationsRainSensor.JPG[/attachment:2ozylmh5]
Thanks again!
Denny
September 26, 2013 at 6:00 pm #25583
djagerifParticipantHow about making the pin selection a menu option?
Ingo
September 27, 2013 at 2:03 am #25584
Dan in CAParticipantJust when I was thinking the program was getting stable and I could concentrate on some evapotranspiration calculations (weather based irrigation stuff…).
These suggestions are definitely interesting. I will give it some thought.
@Denny,
Thanks for the link to the Git book.
I’m new to Git also and that looks like a great resource. As a Windows user I have found TortoiseGit:
http://code.google.com/p/tortoisegit/
to be extremely helpful, especially since I’ve been using TortoiseSVN as my internal version control system throughout this project.@Ingo,
What sort of menu option would you suggest for the rain sensor pin define? An addition to the Options page comes to mind but your suggestion for the CPU temp. toggle was excellent and didn’t add to the already long Options page.Thanks.
Dan
September 27, 2013 at 3:13 am #25585
KanyonKrisParticipantDan, I’ve been looking into ET myself. I started a thread called Weather algorithms to discuss how to use weather data to water smarter.
September 27, 2013 at 5:32 am #25586
djagerifParticipantDan,
There are two schools of thought here. The one is to add the setting to the Options page just like the HTTP port to be an integer number between X and Y. This way is simple and without any fuss. The second is to make the part of the config file that you need to edit manually. With this option you save on the Options Page space but then it’s a manual thing to edit. Fortunately it’s a static variable and once set then it will probably not change for the life of the Pi.
So, both have advantages and disadvantages. I would say stick it in the Options page and see what the reaction is from the community. My suggestion is to put it next to the ‘Use RS’ checkbox. If checked, then enable/make it visible, if unchecked then either disable it or hide it.
And… You could use either a textbox or a dropdownlist for GPIO pins.
Ingo
September 27, 2013 at 10:58 am #25587
mikethechapParticipantI had my first error this AM. I was trying to run a program one-time manually. I tried it first from the web app and then from the interval program. From the Web App, there was an error message saying it could not communicate with the sprinkler. On the interval program, it threw the error noted at the bottom of my post here.
To try to help with troubleshooting, I tried to see if I could get it to run manually and it did fine (running right now, in fact).
This is only in the run-once program setting.
I hope this helps.
Thanks, Mike
at /cr
schedule_stations() takes exactly 1 argument (0 given)
Python
/home/pi/OSPi/ospi.py in GET, line 810
Web
GET http://192.168.1.49:8080/cr
Traceback (innermost first)
/home/pi/OSPi/ospi.py in GET
schedule_stations() …
▶ Local vars
/home/pi/OSPi/web/application.py in handle_class
return tocall(*args) …
▶ Local vars
/home/pi/OSPi/web/application.py in _delegate
return handle_class(cls) …
▶ Local vars
/home/pi/OSPi/web/application.py in handle
return self._delegate(fn, self.fvars, args) …
▶ Local vars
/home/pi/OSPi/web/application.py in process
return self.handle() …
▶ Local varsINPUT
Variable
Value
pw
‘somepasswordthatI’mjustthrowinginhere’
t
‘[0,0,0,0,0,0,0,1080,1080,0,0,0,0,0,0,0,0]’September 27, 2013 at 5:42 pm #25588
Dan in CAParticipantHi Mike,
There was an update just before the 9/23 one which had that problem.
If you try to check the rev page by adding /rev to the URL of the program you should get a page with a few lines of text that should include
ospi.py revision: 135If it says revision 134 or you get a not found error, you just need to update to the latest version.
If you are running revision 135 and are still getting the error, please let me know.
Thanks.
Dan
September 30, 2013 at 2:31 am #25589
mikethechapParticipantThanks, Dan!
That did the trick. I think I must have updated just prior to you uploading the new version.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Python interval program update 9/23/13