![]() ![]() ![]() ![]() |
|
The HiPi::Interface::ENER002 module provides a high level interface for controlling Energenie ENER002 switched sockets and the ENER010 4 Way Radio Controlled Extension Lead.
It uses HiPi::Controller::ENER314_RT as a backend.
Returns a new instance of the HiPi::Interface::ENER002 class that can be used to control switches in the group 'groupid'. The groupid is a 20 bit number so any number between 0x1 ( 1 ) and 0xfffff ( 1,048,575 ). Each groupid can be used to pair with and control switches using up to 4 different switch identifiers. Typically this means you can control up to 4 different switch sockets with 1 groupid. If using with the ENER010 4 way extension lead then 1 groupid will be used to control the 4 sockets on the extension. You can use as many different groupid values as you wish allowing you to control as many different sockets and extension individually as you wish. When using the HiPi::Controller::ENER314_RT controller as a backend, each message is broadcast ( repeated ) 15 times. You may find that increasing this number improves switch operation. You can set 'repeat'to a number between 15 and 100. my $group = HiPi::Interface::ENER002->new( groupid => 0x6C6C6, repeat => 25, );
pair a socket with this group. $socket = a number between 1 and 4 $seconds = optional number of seconds to broadcast the pairing message. By default the message is broadcast for 10 seconds. $group->pair_socket(1); will broadcast a message to pair a socket with this groupid as socket 1. Calling $group->pair_socket(1) is the same as pressing button 1 ( either on or off ) on the remote control for your sockets. You can follow the instructions provided with the Energenie sockets on how to pair with your remote and substitute a call to $group->pair_socket in place of pressing the remote buttons. If you want to broadcast for a longer period of time, say 20 seconds, call $group->pair_socket(1, 20). When using to pair with a ENER010 extension lead you can use any socket number ( 1 to 4 ) in the pairing call.
switch a socket on or off. $socket = a number between 0 and 4. Use 0 (zero) to switch all sockets on or off $value = 1 ( on ) or 0 ( off ) $group->switch_socket( 3, 1 ) switch socket 3 on $group->switch_socket( 2, 0 ) switch socket 2 off $group->switch_socket( 0, 1 ) switch all sockets on