Forum Replies Created
-
AuthorPosts
-
August 22, 2013 at 6:39 pm in reply to: sprinklers_pi – An alternative sprinkler control program #24961
ndboostParticipant@rszimm wrote:
Ahhh, so the raspberrypi is set to UTC rather than to MDT. I’m also in MDT and this is what I get when I run it:
pi@raspberrypi1:~$ date
Thu Aug 1 09:36:21 MDT 2013to set the timezone, run
sudo dpkg-reconfigure tzdata
This solved so much of my headaches.. thank you so much.
August 22, 2013 at 6:01 pm in reply to: sprinklers_pi – An alternative sprinkler control program #24960
ndboostParticipantgive us some source code on github so we can contribute!!! 🙂
ndboostParticipantA bit of an update …
I decided to focus directly on building on the backend side of things.. for now the front-end web ui wont make much progress. Instead the REST based API will be my primary focus.
So far the schedule system is working and you can do things such as.. “every 12 hours on the 6th hour before 10th minute” for your schedules.. The GPIO interface is written but not tested as functional yet as i havent had time to bootup another RPi of mine as a dev unit.
Authentication is also working and you can create/delete users as well as login/logout..
Right now its running on mongodb as the database .. which for this purpose is probably quite heavy.
ndboostParticipantIts a rare occasion indeed. Good to know though thanks Ray.
ndboostParticipantIm going to have to do some actual testing of both of these scenarios i fear.
ndboostParticipantAlright so i’ve figured a work around for Sinatra authentication and started work on the REST API to handle manual schedules using Rufus-Scheduler but for the life of me i can’t figure out how to get it to work.
So i think its back to the drawing board to figure out another task scheduling solution. If i cant figure a multi-threaded efficient solution i may end up going back to a python/flask solution blah!
ndboostParticipantI definitely have a huge concern for memory consumption pothibo.. I know rails is a friggin hog, i attempted to dev this in sinatrarb but its a pain getting a worthy authentication system in place with it.
I might still switch back over to sinatra since its light weight.. but until i find a feasible authentication solution i’m not comfortable using it.
This will be running on a rev2 512mb RPi btw.
I have to hit up the electronics warehouse here in Arizona for a few parts.. a few 74hc74’s to mimic the shift register the OS uses so i dont have to bring the current sprinkler system offline (i have several RPi’s) But hopefully should be able to make some pretty significant breakthroughs on the code base this weekend.
ndboostParticipantI still haven’t come across an ideal solution to task scheduling.. which is what will be needed to handle “run for 15 mins”, or “run at 12pm tomorrow”.
I am trying to not rely on external services such as resque, IronMQ, IronWorker etc..
I found this: http://rufus.rubyforge.org/rufus-scheduler/ rufus-scheduler.. works similar to cron tab.
the concept will be the program will have a restful json based API to interact with the stations.. things like
http://rubysprinkler/stations/
/ /runtime/
or for scheduled runs
http://rubysprinkler/stations//schedule/ one example i have currently “working” is: http://rubysprinkler/stations/1/start/runtime/10 & http://rubysrpinkler/stations/1/stop
ndboostParticipantFor those that were interested the program is written in Ruby on Rails…
https://github.com/mikedevita/rubysprinklerthere is no working interface with the sprinkler system yet, still laying the config/foundation.. but authentication works.
Default user/pass is [email protected]/changeme
uses sqlite as the database backend. the eventual plan is to disable registrations and just have a user account created by default.
ndboostParticipantI dont currently need help.. I also switched from PHP to Ruby as its easier for me to integrate.
ndboostParticipantCan someone chime in and provide some lamen term explanation of how the ipensprinkler interval program function
def setShiftRegister(srvals) works? What do each of these defined pins map out to?I am trying to translate this python code to ruby.
pin_sr_dat = 27 #Use for rev 2 Pi
pin_sr_clk = 4
pin_sr_noe = 17
pin_sr_lat = 22
ndboostParticipant@ray wrote:
First of all, I assume your ospi.py is copied to /var/www/opensprinkler folder, otherwise it obviously won’t find the .py file to run. Second, instead of using the $host and $port variables, I believe you can just do ‘python ospi.py 80’ to start up the program on http port 80. Note that you don’t have to put the files in /var/www/opensprinkler folder — when the python server starts, it will map the http link to whatever folder it’s running the ospi.py program from. For example, you can put it in /home/yourusername/OSPI and run the python program from there.
I took your advice and changed the rc.local to be like so:
cd /var/www/opensprinkler
/usr/bin/python ospi.py 80
exit 0
i then issued:
sudo reboot
Once the pi rebooted i ran:
ps -ef | grep python
which returned:
pi@opensprinkler ~ $ ps -ef | grep python
root 2130 2128 0 01:56 ? 00:00:00 sudo /usr/bin/python ospi.py 80
root 2131 2130 1 01:56 ? 00:00:01 /usr/bin/python ospi.py 80
pi 2310 2292 0 01:58 pts/0 00:00:00 grep --color=auto pythonseems to be working now. I believe it was the absolute path to python that made it work
I’ll fork the Github repo examples for the interval_program and update it appropriately.
Thanks -
AuthorPosts