Perl Modules for Raspberry Pi
Version 0.92 - released 28 March 2024


This module provides a high level interface for controlling Energenie ENER002 switched sockets, MIHome MIHO002 switched sockets and the ENER010 4 Way Radio Controlled Extension Lead.

It can use the 2 way transceiver HiPi::Energenie::ENER314_RT or the 1 way HiPi::Energenie::ENER314 transmitter as a backend.

The module is provided for simple on / off switching in Perl code. A command hipi_energenie is installed with the distribution that provides command line based control and monitoring of Energenie devices.


Creates an instance of the HiPi::Interface::EnergenieSwitch class that allows you to switch energenie sockets.

Allowed parameters and their defaults are:

my $if = HiPi::Interface::EnergenieSwitch->new(
    groupid      => 0x6C6C6,
    backend      => 'ENER314_RT',


By specifying different groupid values you may control any number of switches. Each groupid can control up to 4 switches.

If you are using the 1 way ENER314 board, the group id is ignored as that board has a hard coded groupid and can only control a maximum of 4 switches.

The groupid must be a number between 0x1 and 0xFFFFF.

You can create new random groupid values with the code:

my $group = 1 + int(rand(0xFFFFE));

The command hipi_energenie installed with the distribution makes it easier to control switches and save the groupid associated with your different switches.


The board to have connected to your Raspberry Pi. Either ENER314_RT or ENER314.

Pair a socket with the instance groupid.

Set the socket into pairing mode then issue the command to pair the socket number you want to assign ( 1 to 4 )

$if->pair_socket( 2 );

Use socket 1 if you are pairing an ENER010 4 gang extension.

Switch a socket already paired with the instance groupid

# switch socket 3 on
$if->switch_socket( 3, 1 );

# switch socket 2 off
$if->switch_socket( 2, 0 );

# switch all sockets in the group on
$if->switch_socket( 0, 1 );

Get or set the value for groupid

my $groupid = $if->groupid;
$if->groupid( 0x46FC );