The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 configured FriendlyName from the WeMo device

METHODS

query

Sends a UPnP message to the WeMo device to query the current state

on

Sends a UPnP message to the WeMo device to Turn Power ON

off

Sends a UPnP message to the WeMo device to Turn Power OFF

switch

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

cycle

Sends UPnP messages to the WeMo device to Cycle Power (ON-OFF-ON or OFF-ON-OFF).

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

Copyright (c) 2013 Michael R. Davis

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.

Portions of the WeMo Implementation Copyright (c) 2013 Eric Blue

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

SEE ALSO

WebService::Belkin::Wemo::Device, https://gist.github.com/jscrane/7257511