Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.