FacebookTwitterDiggDeliciousStumbleuponGoogle BookmarksRedditNewsvineTechnoratiMixxPinterest
Pin It

After introducing some dimming features to the PiClock last week, and including a dimmer configuration example, I was asked if the dim config could be swapped out at night, and then back again during the day.   Well it didn't seem too tough a challenge, so the PiClock now includes swapper.sh, which is meant to be run from cron.   It restarts the main python script with a config that you specify.

b_200_200_16777215_00_images_20160727_102702.jpgb_200_200_16777215_00_images_20160727_102632.jpg

 

 

 

 

So my bedside piclock now switches between day and night modes.   Previously it was continuously dimmed. Of course the project is on GitHub ( https://github.com/n0bel/PiClock ) and switcher.sh has been added.    The Install instructions have been updated, and is excerpted here:

Switching skins at certain times of the day

This is optional, but if its just too bright at night, a switcher script will kill and restart PyQtPiClock with an alternate config.

First you need to set up an alternate config. Config.py is the normal name, so perhaps Config-Night.py might be appropriate. For a dimmer display use Config-Example-Bedside.py as a guide.

Now we'll tell our friend cron to run the switcher script (switcher.sh) on day/night cycles. Run the cron editor: (should not be roor)

crontab -e

Add lines similar to this:

0 8 * * * sh /home/pi/PiClock/switcher.sh Config
0 21 * * * sh /home/pi/PiClock/switcher.sh Config-Night

The 8 there means 8am, to switch to the normal config, and the 21 means switch to Config-Night at 9pm. More info on crontab can be found here: https://en.wikipedia.org/wiki/Cron