Last active
January 1, 2018 19:38
-
-
Save ghostbitmeta/558e46cec0291c688304 to your computer and use it in GitHub Desktop.
Bash script to control an air purifier through LIRC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $1 == "on" ] || [ $1 == "off" ]; then | |
irsend SEND_ONCE hoover "KEY_POWER" | |
exit | |
fi | |
DIR="Home_Automation" | |
ON_FILE="air_purifier_on.txt" | |
OFF_FILE="air_purifier_off.txt" | |
dropbox download "$DIR" | |
if [ -f "$DIR/$ON_FILE" ]; then | |
echo "Turning on Air Purifier" | |
# Power On | |
irsend SEND_ONCE hoover "KEY_POWER" | |
sleep 3 | |
# Change speed to automatic mode | |
irsend SEND_ONCE hoover "KEY_SPEED" | |
sleep 2 | |
irsend SEND_ONCE hoover "KEY_SPEED" | |
sleep 2 | |
# Turn off UV light | |
irsend SEND_ONCE hoover "KEY_T" | |
# Delete the file | |
dropbox delete "$DIR/$ON_FILE" | |
rm "$DIR/$ON_FILE" | |
fi | |
if [ -f "$DIR/$OFF_FILE" ]; then | |
echo "Turning off Air Purifier" | |
# Power off | |
irsend SEND_ONCE hoover "KEY_POWER" | |
# Delete the file | |
dropbox delete "$DIR/$OFF_FILE" | |
rm "$DIR/$OFF_FILE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment