NAME

Power::Outlet::WeMo - Control and query a Belkin WeMo power outlet

SYNOPSIS

my $outlet=Power::Outlet::WeMo->new(host => "mywemo");
print $outlet->query, "\n";
print $outlet->on, "\n";
print $outlet->off, "\n";

DESCRIPTION

Power::Outlet::WeMo is a package for controlling and querying an outlet on a Belkin WeMo network attached power outlet.

USAGE

use Power::Outlet::WeMo;
use DateTime;
my $lamp=Power::Outlet::WeMo->new(host=>"mywemo");
my $hour=DateTime->now->hour;
my $night=$hour > 20 ? 1 : $hour < 06 ? 1 : 0;
if ($night) {
  print $lamp->on, "\n";
} else {
  print $lamp->off, "\n";
}

CONSTRUCTOR

new

my $outlet=Power::Outlet->new(type=>"WeMo", "host=>"mywemo");
my $outlet=Power::Outlet::WeMo->new(host=>"mywemo");

PROPERTIES

host

Sets and returns the hostname or IP address.

Note: Set IP address via DHCP static mapping

port

Sets and returns the port number.

name

Returns the host name (for now)

TODO: Pull from UPnP FriendlyName

METHODS

query

Sends a TCP/IP message to the iBoot device to query the current state

on

Sends a TCP/IP message to the iBoot device to Turn Power ON

off

Sends a TCP/IP message to the iBoot device to Turn Power OFF

switch

Queries the device for the current status and then requests the opposite.

cycle

BUGS

Please log on RT and send an email to the author.

SUPPORT

DavisNetworks.com supports all Perl applications including this package.

AUTHOR

Michael R. Davis
CPAN ID: MRDVT
DavisNetworks.com

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO