-
Notifications
You must be signed in to change notification settings - Fork 22
gui_cron_tools
Cron is used to run scripts at specified times on the raspberry pi, there are several tools in the pigrow that can be control how this happens
Allows you to pause and unpause a cron job, this is designed to be run by cron and used to do things like disable the camera when the lamp is turned off and turn it on again when the lamp is turned back on.
a typical cron job would look like;
30 7 * * * /home/pi/Pigrow/scripts/cron/cron_pause.py script=camcap.py pause=true
30 19 * * * /home/pi/Pigrow/scripts/cron/cron_pause.py script=camcap.py pause=false
This will pause any cron job containing the text 'camcap.py' at 7:30 AM by placing a # in front of the line then enable it at 7:30 PM by removing that hash.
This can also be used with a named sensor by supplying the string as it appears in cron, ensure to capture spaces by enclosing the value in speech marks;
cron_pause.py script="log_sensor_module.py name=bmetemp" pause=true
This is a tool for changing a setting in a key=value config file, useful for raising camera brightness at night for example, a typical cron line would be;
30 7 * * * /home/pi/Pigrow/scripts/cron/change_setting.py conf=cam1_set.txt brightness=200
This changes the setting 'brightness' in /home//Pigrow/config/cam1_set.txt to a value of 200.
It's possible to add as many values to change as required;
change_setting.py conf=cam1_set.txt brightness=200 gain=4 color_balance=incandescent
Allows you to automatically change a trigger condition, this can be used to pause a trigger at set times for example disabling the fan at night.
30 7 * * * /home/pi/Pigrow/scripts/cron/set_trigger_condition.py name=fan_trigger set=pause
30 19 * * * /home/pi/Pigrow/scripts/cron/set_trigger_condition.py name=fan_trigger set=off
This will stop the fan from triggering after 7:30 then turn the trigger back on at 19:30, it's important to set it to the off position rather than the on position when re-enabling as this will allow it to turn on if the threashold is exceeded. After pausing a second command to set the device to the desired state should also be used, for example turning the fan off.
trigger_name - the name of the trigger as set in the gui
set - on, off, pause what the trigger status will be set to
Internally this uses
pigrow_defs.set_condition(condition_name=trigger_name, trig_direction=set_direct, cooldown=cooldown)