The idea of an alarm clock, or how to combine a book, CD-ROM, hairdryer, old nokia and a bit of shell for this?
![image](https://habrastorage.org/getpro/habr/post_images/320/957/d87/320957d8717172035ec161d4bbf92994.jpg)
If interested - I ask for a cut!
Book switch.
Open your favorite text editor and write the following sh script in it:
#!/bin/bash
eject /dev/cdrom
sleep 5
eject -t /dev/cdrom
Place a book next to the CDROM, and under it is a surge protector (like this).
![image](https://habrastorage.org/getpro/habr/post_images/77c/6d6/f1a/77c6d6f1a50491e81760c9043a59ecb8.jpg)
Run the script and watch the book fall on the button to turn off the network filter from the left tray of the sidirom. Set the script to run on cron and include in the network filter everything that needs to be turned off or on as scheduled.
![image](https://habrastorage.org/getpro/habr/post_images/7b8/f5a/a5d/7b8f5aa5de2ea5dc725ecb0729c46f9f.jpg)
Few? I agree.
Extra freedom.
Obviously, something needs to be included in the surge protector. For example, you can set an alarm.
We take an ordinary small hair dryer and insert it into the filter. Hang over the bed. We program inclusion at 7 in the morning and we wake up under the invigorating warm breeze in the face. (like this)
![image](https://habrastorage.org/getpro/habr/post_images/efe/a6f/370/efea6f370a32aa85090fd48b8da7be11.jpg)
Not enough? Then move on.
Manage dream.
What prevents the inclusion of an “alarm-hair dryer” remotely at our request? Nothing. Of course, you can get confused with the commands received through the network. But suddenly something terrible will happen and the Internet will disappear (for example, I regularly forget to pay for my own, and he often falls off stupidly)?
So, you need to do the programming of its inclusion through the incoming SMS. I already wrote here on this topic, but I repeat for this particular case.
In a nutshell: Take an old nokia with bluetooth, pair it on this very blue tooth with a computer with the gnokii driver installed on Linux, and then create something like this script:
#!/bin/bash
inp=$(gnokii --getsms IN 1 end)
echo $inp>/home/light204/Desktop/inp.txt
# приказ по смс
counter_seven=$(grep -c 7 /home/light204/Desktop/inp.txt)
counter_eight=$(grep -c 8 /home/light204/Desktop/inp.txt)
counter_nine=$(grep -c 9 /home/light204/Desktop/inp.txt)
killall gnokii
#текущая дата
$time='date +%H'
if [ "$counter_seven" == "1" AND "$time" == "07"]; then
eject /dev/cdrom
sleep 5
eject -t /dev/cdrom
elif [ "$counter_eight" == "1" AND "$time" == "08"]; then
eject /dev/cdrom
sleep 5
eject -t /dev/cdrom
elif [ "$counter_nine" == "1" AND "$time" == "09"]; then
eject /dev/cdrom
sleep 5
eject -t /dev/cdrom
fi
sleep 3
killall gnokii
gnokii --deletesms IN 1 end
sleep 700
(it is supposed that a number will come in smsk that means the hour the alarm goes off)
Let this script automatically check for new messages at least every 3-4 minutes automatically (so as not to oversleep even in the most unsuccessful scenario).
Now you (especially if you finish the presented script to your needs), even when away from home, can let another person sleep peacefully in your bed, remotely, by SMS, programming the moment of his waking up under the gentle breeze of a hair dryer in your face.
Good luck and have a nice wake up :)
UPD 1.0
0. Thanks to avalak, I clarify that really sleep 700 is not needed in the second script. He stayed with debugging.
1. A book doesn’t always press a button. This is because it is not monolithic, but consists of pages (oh well!). But, if you squeeze it, then the frequency of failures can be greatly reduced. Like this:
![image](https://habrastorage.org/getpro/habr/post_images/4e4/0da/c0a/4e40dac0a790e656360bded5da8bef2b.jpg)