OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Python interval program update 8/01/13 Re: Re: Python interval program update 8/01/13

#25236

craigmw
Participant

Dan – One other thing…

On the Wiki page for your program on the OSPi, you might want to add a SLEEP 60 to the section on automatically starting up the interval program. I had trouble with this because when I switched to a Class 10 SD card. Apparently, there is not enough time for the RPi to gather the WiFi IP address before the script runs. Putting a SLEEP 60 just before your code in rc.local seems to fix this. I had been running my OSPi with a Class 4 SD card, but it became corrupted and I switched to a Class 10 card. After this, the interval program would not autoload.

My rc.local is:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ “$_IP” ]; then
printf “My IP address is %sn” “$_IP”
fi

sleep 60

host=$(hostname -I | sed ‘s/ *$//g’)
port=:8088
cd /home/pi/OSPi/
## If you aren’t sure that the path to python on your Pi is /usr/bin/, use whereis python to determine the location
/usr/bin/python ospi.py $host$port

exit 0