A Java library for controlling the Edimax Smart Plug SP-1101W and SP-2101W.
Create a SmartPlug object to control your plug.
PlugCredentials credentials = new PlugCredentials("admin","1234");
PlugConnection connection = new LocalHTTPConnection(credentials,"192.168.178.34");
SmartPlug smartPlug = new SmartPlug(connection);
Use the various methods of the smartPlug
object to get information or toggle the plug state.
ScheduleDay[] schedule = smartPlug.getSchedule();
PowerInformation powInfo = smartPlug.getPowerInformation();
// Toggle your plug on or off depending on the current status.
smartPlug.toggle();
// Switch your plug on.
smartPlug.switchOn();
// get the history
float[] history = smartPlug.getHistory(SmartPlug.TimeUnit.HOUR, LocalDateTime.now().minusHours(3), LocalDateTime.now().plusHours(1));
-
switch on and off
smartPlug.switchOn(); smartPlug.switchOff();
-
get current state (on and off)
State state = smartPlug.getState()
-
toggle the current state (sends two requests)
smartPlug.toggle()
-
get the history (partially)
float[] history = smartPlug.getHistory(SmartPlug.TimeUnit.HOUR, LocalDateTime.now().minusHours(3), LocalDateTime.now().plusHours(1));
-
get the schedule
ScheduleDay[] schedule = smartPlug.getSchedule();
-
change the schedule
-
get the power information
PowerInformation powInfo = smartPlug.getPowerInformation();
-
get the system information (including the name)
SystemInformation sysInfo = getSystemInformation();
-
change the plug name
smartPlug.setName("My Smart Plug");
- get budget control information
- change budget control information
- get email notification information
- change email notification information
- get the plug time settings
- change the plug time settings
- local communication
- send messages
- receive messages
- plug discovery
- cloud communication
- send messages
- receive messages
- plug discovery (is this possible with cloud communication?)
- [History] The history values are accumulated values per hour (only when requesting the history for a day).
- [Command Line] Not all methods from
SmartPlug
can be accessed via the command line. - [Command Line] There is no command line help text.
This project is open source licensed under the BSD 3-Clause License. Please see the LICENSE file for more information.