dev-master
9999999-devPackage to communicate with EdiMax EdiPlug smart power plugs.
MIT
The Requires
by Rob Stiles
Wallogit.com
2017 © Pedro Peláez
Package to communicate with EdiMax EdiPlug smart power plugs.
A package to communicate with EdiMax EdiPlug smart power plugs., (*1)
This package will allow you to check the power status of your plug, turn it off and on as well as retrieve and set new power schedules., (*2)
A work in progress with basic functionality., (*3)
// Create the locator
$locator = new Locator();
// Spend 5 seconds looking for plugs
$plugs = $locator->scan(5);
foreach($plugs as $plug) {
echo "MAC: $plug->mac\n" ;
echo "Manufacturer: $plug->manufacturer\n";
echo "Model: $plug->model\n";
echo "Version: $plug->version\n";
echo "IP Address: $plug->ip_address\n";
}
// Create object with address, username and password.
$plug = new EdiPlug('192.168.1.100', 'admin', '1234');
// Turn it on
$plug->on();
// Turn it off
$plug->off()
// Or use its power property
$plug->power = true;
$plug = new EdiPlug('192.168.1.100', 'admin', '1234');
// Get the week's schedule information from the plug.
$week_schedule = $plug->schedule;
// Cycle through each day
foreach($week_schedule as $day => $day_schedule) {
// Turn off all the schedules
$day_schedule->enabled = false;
}
// Send new schedule back to the plug
$plug->schedule = $week_schedule;
$plug = new EdiPlug('192.168.1.100', 'admin', '1234');
// Get the week's schedule information from the plug.
$week_schedule = $plug->schedule;
// Cycle through each on/off period for Tuesday
foreach($week_schedule[WeekSchedule::TUESDAY] as $period) {
echo "On at $period->on, off at $period->off<br />\n";
}
$plug = new EdiPlug('192.168.1.100', 'admin', '1234');
$week_schedule = $plug->schedule;
$friday = $week_schedule[WeekSchedule::FRIDAY];
$friday->add(TimePeriod::createFromTimes(
Carbon::createFromTime(19,00),
Carbon::createFromTime(23,00)
));
$friday->enabled = true;
$plug->schedule = $week_schedule;
Package to communicate with EdiMax EdiPlug smart power plugs.
MIT