A simple bash script alarm to mimic a "natural" sunrise light wake-up.
The script works with the tp-link LB120 smart wifi LED bulb. It may work with the LB110/LB130 or with the entire range of tp-link wifi bulbs. tp-link Circadian Alarm uses the tplink-lightbulb nodejs controller and it is based on this simple Bash alarm clock script.
GitHub repository https://github.com/Gregory-K/tplight-circadian-alarm.
User inputs the desired wake-up time. The script calculates the remaining time and one hour before wake-up time it starts sending commands to the wifi bulb. The bulb will start with 2700K color temperature and 5% brightness and will gradually ascend to 4000K/100% 10 minutes before wake-up time.
It is supposed to assist you in waking-up in a more "natural" way using external cues to adjust your circadian rhythms. Of course, this particular method is not scientifically proved in any way. Although circadian rhythms are endogenous ("built-in", self-sustained), they are adjusted (entrained) to the local environment by external cues called zeitgebers (from German, "time giver"), which include light, temperature and redox cycles. ref: Wikipedia
- a tp-link LB120 (tried and tested)
- Bash Shell ...
- pre-installed on Linux and MacOS
- can be installed on rooted Android and Windows
- NodeJS
- tplink-lightbulb nodejs controller
- Guess you have already installed NodeJS.
- Install the tplink-lightbulb nodejs controller.
- tplink-lightbulb
npm i -g tplink-lightbulb
.
- tplink-lightbulb
- Download the sunrise.alarm.sh and make it executable
chmod +x sunrise.alarm.sh
- Find your bulb
tplight scan
. - Edit sunrise.alarm.sh -> line:10 (enter your bulb's IP address). Better to assign a permanent IP to your bulb. Check your router/DHCP-server
- Execute sunrise.alarm.sh
./sunrise.alarm.sh
and input the desired wake-time in HH:MM format.- It is recommended to execute it on your home/office server (remotely via ssh) using a screen or tmux session and detaching from it.
- In any case the computer/device running the script must be left turned on.
- You can create a symlink to /usr/local/bin
ln -s ./sunrise.alarm.sh /usr/local/bin/sunrise.alarm.sh
in order to execute sunrise.alarm.sh from anywhere as a command.
- It is recommended to execute it on your home/office server (remotely via ssh) using a screen or tmux session and detaching from it.
- Wait ...to wake up.