Skip to content

Instantly share code, notes, and snippets.

@karolyi
Last active May 21, 2017 13:53
Show Gist options
  • Save karolyi/1566ebc4591dc31c300a to your computer and use it in GitHub Desktop.
Save karolyi/1566ebc4591dc31c300a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Turns your smartplug on and off. Set the IP and the password in the variables below.
# Works with SP-1101w and SP-2101W plugs.
# http://www.edimax.com/images/Image/manual/HomeAutomation/SP-1101W/SP-1101W_manual.pdf
EDIMAX_IP='192.168.1.141'
EDIMAX_PASSWORD='password'
STATE='ON'
if [[ $1 == 'off' ]]; then
STATE='OFF'
fi
STR_1='<?xml version="1.0" encoding="UTF8"?><SMARTPLUG id="edimax"><CMD id="setup"><Device.System.Power.State>'
STR_2='</Device.System.Power.State></CMD></SMARTPLUG>'
curl http://$EDIMAX_IP:10000/smartplug.cgi -u admin:$EDIMAX_PASSWORD --data "$STR_1$STATE$STR_2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment