Skip to content
/ ediplug Public

Package to communicate with EdiMax EdiPlug smart power plugs.

License

Notifications You must be signed in to change notification settings

kebian/ediplug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EdiPlug

A package to communicate with EdiMax EdiPlug smart power plugs.

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.

A work in progress with basic functionality.

Example Code

Locating Plugs

// 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";
}

Turning a Plug On or Off

// 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;

Disable All Schedules

	$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;

Cycle Through Each Period for Tuesday

	$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";
	}

Set Power to Come On Friday 7pm - 11pm

	$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;

About

Package to communicate with EdiMax EdiPlug smart power plugs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages