Skip to content

Commit

Permalink
Fixed some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydrosys4 committed Dec 15, 2018
1 parent e331e4e commit 00699d4
Show file tree
Hide file tree
Showing 12 changed files with 879 additions and 81 deletions.
1 change: 1 addition & 0 deletions Prepare for Release/Release checklist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ OPERATING SYSTEM LEVEL:
1) disable SSH -> sudo raspi-config -> advanced -> disable SSH server
2) Check wifi password (AP mode) is "hydrosystem"-> sudo nano /etc/hostapd/hostapd.conf
4) check that the wifi account is deleted -> nano /etc/wpa_supplicant/wpa_supplicant.conf
5) set ownership of the files: sudo chown -R $USER ~/env/autonomMaster2

HYDROSYSTEM SW LEVEL:

Expand Down
19 changes: 9 additions & 10 deletions SchedulerMod.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import apscheduler

from apscheduler.schedulers.background import BackgroundScheduler
logger = logging.getLogger("hydrosys4."+__name__)


# The "apscheduler." prefix is hard coded
Expand All @@ -25,29 +26,27 @@




logger = logging.getLogger("hydrosys4."+__name__)




def print_job():
global sched
sched.print_jobs()
sched.print_jobs()
return True

def start_scheduler():
global sched
sched.start()
sched.start()
return True

def removealljobs():
global sched
for job in sched.get_jobs():
job.remove()
job.remove()
return True

def stop_scheduler():
global sched
if sched.running:
sched.shutdown(wait=False)
sched.shutdown(wait=False)
return True

def get_next_run_time(jobname):
global sched
Expand Down
8 changes: 5 additions & 3 deletions autowateringmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,15 @@ def autowateringexecute(refsensor,element):

# implment alert message for the cycle exceeding days, and reset the cycle
if workmode!="None":
if sensordbmod.timediffdays(datetime.now(),AUTO_data[element]["cyclestartdate"]) > maxdays:
timedeltadays=sensordbmod.timediffdays(datetime.now(),AUTO_data[element]["cyclestartdate"])
if (timedeltadays > maxdays): #the upper limit is set in case of abrupt time change
textmessage="WARNING "+ sensor + " watering cycle is taking too many days, watering system: " + element + ". Reset watering cycle"
print textmessage
# in case of full Auto, activate pump for minimum pulse period
if workmode=="Full Auto":
textmessage="WARNING "+ sensor + " watering cycle is taking too many days, watering system: " + element + ". Activate Min pulse + Reset watering cycle"
activatewater(element, duration)
if (timedeltadays < maxdays+2): #the upper limit is set in case of abrupt time change
textmessage="WARNING "+ sensor + " watering cycle is taking too many days, watering system: " + element + ". Activate Min pulse + Reset watering cycle"
activatewater(element, duration)
#send alert mail notification
if mailtype!="warningonly":
emailmod.sendallmail("alert", textmessage)
Expand Down
2 changes: 2 additions & 0 deletions bash/install_hydrosys4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ if [ "$autostart" == "yes" ]; then
sudo iptables-restore < /home/pi/iptables.rules
# clock
echo "HYDROSYS4-set HW clock ****************************************"
echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-1/new_device || true
hwclock -s || true
echo "HYDROSYS4-start system ****************************************"
cd /home/pi/env/autonom/
sudo python /home/pi/env/autonom/bentornado.py &
Expand Down
Loading

0 comments on commit 00699d4

Please sign in to comment.