Forum Replies Created
-
AuthorPosts
-
Dan in CAParticipantMike,
The OpenSprinkler Pi board already has an RTC on-board.
When I first started working with it I used the following to access the clock:
“FYI
after a few different iterations, here are the settings I used to access the RTC:1. added following lines to /etc/modules (sudo nano /etc/modules)
i2c-bcm2708
rtc-ds13072. added following line to /etc/rc.local
for a 256MB Raspberry Pi Model B:echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
for a 512MB Raspberry Pi Model B (i2c-0 is changed to i2c-1):
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
3. Reboot
must be root or use sudo:
to read clock:hwclock -r
set the hardware clock from the current system time:
hwclock -w
set the system time from the hardware clock:
hwclock -s
“
‘I haven’t tried setting it up according to the instructions on the Wiki. It says to add
hwclock -s
to /ect/rc.local which will set the system time from the RTC at boot but I am not sure if the system will keep updating the time from the network. If so the instructions don’t say how to update th RTC from the network.
The way it should work is that the system uses the RTC if the network is not available but the RTC should be kept up to date from the network otherwise.
Occidentalis is a custom Linux distro developed by Adafruit for educational purposes. I haven’t tried it but if you do, please let us know your experience.
Dan
Dan in CAParticipantHi Ingo,
I have not been able to reproduce the log error you describe.
I ran 4 programs @ 15 min. ea. and the times show correctly.
[attachment=0:3irvykz3]Log-9-13.jpg[/attachment:3irvykz3]One time related change that was made recently was to add a new var (gv.now) which is used for current time throughout the program including the log function. Its value is created from the Pi’s UTC time and adjusted by the time zone setting from the Options page. It is updated once per second at the top of the main loop.
In the log function the finish time is added as:
time.strftime(“%H:%M:%S, %a. %d %b %Y”, time.gmtime(gv.now))+’n’
which gives the current time.Dan
Dan in CAParticipantdaver,
I thought this was going to be an easy one.
Anyway i just pushed another update.
There were some other lines that needed the tabs changed to spaces. I just tested an update from GhiHub and things finally seem to be working right.
Dan
September 12, 2013 at 4:02 pm in reply to: Python Interval Program now has "Ignore rain" option #25529
Dan in CAParticipantNo bother.
If there is a problem, please let me know.I just pushed a fix to GitHub.
If you run the update now the problem should be taken care of.The Ignore rain feature didn’t properly take into account expansion boards.
Dan
September 11, 2013 at 4:12 pm in reply to: Python Interval Program now has "Ignore rain" option #25527
Dan in CAParticipantI was hoping the change in the port setting wouldn’t cause too many progamems.
@ declanslater
The “socket.error: No socket could be created” line in the error message indicates that something is already running on port 80. If you are using Samer’s mobile web app and have a server like Apache running that would produce that result.You will need to manually edit the /data/sd.json file as suggested by Ingo in the previous post*.
*I have edited the instructions in the original post to include instructions for this.
I tested things here but I don’t have Apache running on my test system so I missed that possibility. Sorry about that.
I will be adding Apache and Samer’s app to my test system to avoid this sort of problem in the future.
Dan
Dan in CAParticipantOK, I did a thorough overhaul of the way current time is handled throughout the program.
I think what was causing the timing problem you have been seeing was due to the main_loop using UTC time without adjusting for the time zone setting from Options.
Once that was fixed, it broke a lot of other parts of the program so I made the “now” at the start of the main loop an attribute of the gv module (now is now gv.now and includes the tz adjustment) and used it throughout the program. That fixed the broken parts and simplified the code quite a bit.
I just pushed an update to GitHub. Please check it out and let me know how it goes.
Thanks for “bugging” me about this, I want the program to work flawlessly.
Dan
Dan in CAParticipantHi Ingo,
As I understand it, the Not modified statement means that a web client (browser) requested a file from the server but the version on the server is the same as the copy in the client’s cache. and the client will use that copy.
This reduces the bandwidth needed to display a page.
Dan
Dan in CAParticipantHi Kenbob,
I did some further digging and found 2 places in the code that were still using the timezone data from the Pi.
those have been changed to use the tz setting from the options page.I just pushed an update to GitHub,
If you don’t mind, could you try the update and see if that fixes the problem?I really appreciate your help with this and it looks like we are getting close to a fix. If you are still seeing the same problem after the update I will investigate your suggested changes but there may be a more basic place in the code that needs to be changed.
Thanks.
Dan
Dan in CAParticipantdjmax,
Looks like there is a problem with web.py,
Could you provide some information about what occurred before the error messages?
Was this a new install or an update from a recent version?The easiest fix would probably to just re-install:
http://rayshobby.net/mediawiki/index.php?title=Python_Interval_Program_for_OSPi#From_an_older_version_not_installed_using_gitI have tested the update and a new install and they both worked.
Dan
Dan in CAParticipantkenbob,
The tests I ran worked as expected.
I have posted the updated version of the program. See:
viewtopic.php?f=28&t=329Let me know if you are still having a timing problem after the update.
Dan
August 30, 2013 at 6:27 pm in reply to: Python Interval Program "Run Now" direct HTTP support? #25482
Dan in CAParticipant
Dan in CAParticipantKenbob,
You are right!
Part of the program has been using the TZ setting from the Options page and part of the program has been using the TZ setting from the Pi.This has caused problems for several users if the Pi’s TZ setting is not correct. You can check the setting on the Pi by running the command
date +%Z
This will return the 3 letter code for the time zone the Pi is set for.
I have modified the program to use only the TZ setting from the Options page. I will push an update to GitHub latter today as soon as I make one more small tweak.
Dan
Dan in CAParticipantIf you are working from a windows system you should take a look at winSCP:
http://winscp.net/eng/docs/introduction#featuresI use it to transfer files between my windows system and the Pi. It handles line ending conversion automatically. You can also brows the files on the Pi just like using windows explorer and Open and edit files on the Pi from your windows system.
It is an indispensable tool for me.
Dan
Dan in CAParticipantAlso, since you are using wifi, you might try adding a delay to the rc.local script as described in this post:
viewtopic.php?f=28&t=207#p1294
Dan in CAParticipantKenbob,
I have set up some test programs as you described. I’ll see how it goes and get back to you when I have some results.
Dan
Dan in CAParticipantJust an FYI from the Raspberry Pi FAQ:
What is the usable temperature range?
The Raspberry Pi is built from commercial chips which are qualified to different temperature ranges; the LAN9512 is specified by the manufacturers being qualified from 0°C to 70°C, while the AP is qualified from -40°C to 85°C. You may well find that the board will work outside those temperatures, but we’re not qualifying the board itself to these extremes.
70°C = 158°F
85°C = 185°FDan
Dan in CAParticipantCraig,
I can’t take the credit for the temperature readout. The code was posted by doczaius:
http://rayshobby.net/phpBB3/viewtopic.php?f=28&t=232
He said it was his first attempt at Python programming and it works great.I didn’t even know the Pi could do that until I read his post.
One of the things I love about open source programming is the exchange of ideas. I am learning a ton from working on this project.
Dan
Dan in CAParticipantogtommy,
When you say it loads up to the GUI, do you mean you can log into the web interface over the network?
Are you using Samer’s mobile web app with the program?
You might check this post if you haven’t seen it.
viewtopic.php?f=28&t=207&start=40#p2099If you have both the rc.local script and the init.d scripts installed, you should comment out the rc.local script.
If you are using the rc.local script, you can test if the program is running by issuing the command:
/etc/init.d/ospi status
EDIT: That should be if you are using the init.d script, you can use the status command.Are you using port :8080 in the start up script? and adding the port to the URL when you try to access the program from the network?
Also, is your OSPi directory located as a sub directory of the Pi home directory? If it is located somewhere else you would need to modify the start up script to point to that path.
Dan
Dan in CAParticipantHi Kevin,
Glad your program is behaving better now.
About the error message:
Looks like you found a bug that resulted from adding the sequential/concurrent option. It looks like the options.txt file in the /data directory is out of sync with the program.It probably resulted when you copied the files from the older version of the program to the new data directory.
I’ll check the code and add a fix.Dan
Dan in CAParticipantKevin,
Things to check:
Make sure the “Device time” shown on the home page is correct for your area.
If not, check the time zone setting on the Options page.
If the time zone setting is right but the Device time is not correct, you may need to set the time zone in the Raspberry Pi setup:
Use raspi-config to open the config menu.If the time is correct as shown on the home page, Your program should be on schedule. You can click the “program preview” button on the home page to verify if things are set to go when you expect.
Dan
Dan in CAParticipantAn interesting idea. Let me give it some thought.
I need to update the installation instructions on the wiki before anything else.
Dan
Dan in CAParticipantHi Ingo,
I knew the question of choosing between C and F for the temperature display would come up. I have given it some thought but not come with a final solution yet. The obvious plan would be to add a switch on the Options page but that list is getting pretty long.
Maybe we could reduce the line spacing and squeeze it in without pushing things off the bottom of the page.Dan
Dan in CAParticipantHi Mike,
Try this simplified script in RC.local:
### Start the OSPi interval program
cd /home/pi/OSPi/
python ospi.py 0.0.0.0:8080 &
To make sure the rc.local file is executable, issue the following command:
sudo chmod +x /etc/rc.local
Once you reboot the Pi the program should start running in the background and you can ssh in and do other stuff.
There are more details in the wiki at:
http://rayshobby.net/mediawiki/index.php?title=Python_Interval_Program_for_OSPiDan
Dan in CAParticipantDenny,
Cool, Glad to see you have it working.
The only problem with putting the
gv.sd=getRainState()
where you have it is that it will be missed if a program is already running. You could put it at the start of the loop before the preceding “if” statement or at the end just before the
time.sleep(1)
where the rain delay stuff is and it will get checked once per second.
In the process of adding some rain sensor logic to the program I added:if program_running:
if gv.sd and gv.sd: # Stop stations if use rain sensor and rain detected.
stop_stations()
In the main loop at ~line 235 in my version, and also:
if gv.sd: # Skip if rain delay
return
if gv.sd and gv.sd: # Skip if use rain sensor and rain detected.
returnin the schedule_stations function.
I will include this in the next update as it is similar to what the Arduino based OpenSprinkler does. I don’t know how many folks will add a rain sensor to their system so I won’t do much more than that for now but I will be glad to work with you to get the more advanced selective feature going.
You describe it as a per program selection but I think a per zone/station selection would be doable .
Dan
Dan in CAParticipantVaughano,
After giving this more thought, I don’t think there would be a problem since the daylight savings time is no longer automatic. You need to change the time zone setting on the options page to move to or from daylight time. You would just make the change when no program was running.
Dan
-
AuthorPosts