This is a DIY project to use a Raspberry Pi running a Telegram Bot to turn on and off your Christmas tree.
Yes, this is an old project and a smart plug is simpler... But not that funny!
- Make the setup script executable with
chmod +x install.sh
. - Run the script elevated
sudo ./install.sh
. - Add a cron to automaticallu start the bot, as explained in the Manual Instructions.
- First of all make sure you have installed Python3 typing
python3 --version
in the shell. If not, install it withapt install python3
. - Then install pip3 with
apt install python3-pip
. - Install the Telegram bot API for Python typing
pip3 install pyTelegramBotAPI
. - The GPIO Zero API should be installed by default on Raspbian. If not, follow these instructions.
- Install the emoji library typing
pip3 install emoji
. - Make your script executable with
chmod +x src.py
. - Configure a cron to automatilcally start the Bot when the system boots up typing
sudo crontab -e
and adding@reboot python3 /path/to/mySrcFile.py
.- If you're on a Wi-Fi network, the Raspberry may try to launch the script when the connection is not ready yet, terminating it with an exception. A workaround for this issue is to delay the script launch. Use this instead:
@reboot sleep 30 && python3 /path/to/mySrcFile.py
- If you're on a Wi-Fi network, the Raspberry may try to launch the script when the connection is not ready yet, terminating it with an exception. A workaround for this issue is to delay the script launch. Use this instead: