Skip to content

Instantly share code, notes, and snippets.

@ghostbitmeta
Last active January 1, 2018 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghostbitmeta/558e46cec0291c688304 to your computer and use it in GitHub Desktop.
Save ghostbitmeta/558e46cec0291c688304 to your computer and use it in GitHub Desktop.
Bash script to control an air purifier through LIRC
#!/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