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
# In IFTTT create two webhooks named using the pattern, "$DEVICE_on" and "$DEVICE_off" | |
DEVICE="desk_fan" | |
# This is where the state of the device is kept | |
DEVICE_STATE_FILE=~/.${DEVICE}.state | |
IFTTT_KEY="" | |
# Set the default state of the device to "off" if the status file does not exist | |
[ -s $DEVICE_STATE_FILE ] || echo "off" > $DEVICE_STATE_FILE |