This post describes how to control a special power strip via usb with a Raspberry Pi. The power strip used is a Gembird EnerGenie EG-PM2.
For more articles about Raspberry Pi check: Raspberry Pi
The power strip: Gembird EnerGenie EG-PM2
The Gembird EnerGenie EG-PM2 has totally 6 plugs. Two plugs are always on while the other four plugs can be controlled via USB. I use the two for the controlling Raspberry Pi and the network switch. The other four are used for the other Raspberry Pis within the cabinet.
To connect the USB port of the power strip to the Raspberry Pi an USB Type B (Power strip side) to USB Type A (Pi side) is needed.
The tool: sispmctl
To send commands to the power strip the tool sispmctl is needed. The tool is available at https://sispmctl.sourceforge.net. As I am writing this post I have version 4.9 installed. To install the tool I had to additionally install libusb-dev. Here are all the steps.
user1@pi:~ $ sudo apt install libusb-dev
..
Processing triggers for man-db (2.9.4-2) ...
user1@pi:~ $ tar -xf sispmctl-4.9.tar.gz
user1@pi:~ $ cd sispmctl-4.9/
user1@pi:~/sispmctl-4.9 $ ./configure
checking build system type... aarch64-unknown-linux-gnu
...
Good - your configure finished. Start make now
user1@pi:~/sispmctl-4.9 $ make
make all-recursive
.....
make[1]: Leaving directory '/home/user1/sispmctl-4.9'
user1@pi:~/sispmctl-4.9 $ sudo make install
Making install in src
.....
make[1]: Leaving directory '/home/user1/sispmctl-4.9'
user1@pi:~/sispmctl-4.9 $ sudo ldconfig
How to use it
All commands have to be executed with sudo. To see the current status run:
user1@pi:~ $sudo sispmctl -g all
Accessing Gembird #0 USB device 003
Status of outlet 1: off
Status of outlet 2: off
Status of outlet 3: off
Status of outlet 4: off
You can enable a specific plug now with the number of the plug shown in status overview.
user1@pi:~ $ sudo sispmctl -o 4
Accessing Gembird #0 USB device 003
Switched outlet 4 on
user1@pi:~ $ sudo sispmctl -g all
Accessing Gembird #0 USB device 003
Status of outlet 1: off
Status of outlet 2: off
Status of outlet 3: off
Status of outlet 4: on
All plugs on and all plugs off can be achieved with the following commands.
user1@pi:~ $ sudo sispmctl -o all
Accessing Gembird #0 USB device 003
Switched outlet 1 on
Switched outlet 2 on
Switched outlet 3 on
Switched outlet 4 on
user1@pi:~ $ sudo sispmctl -f all
Accessing Gembird #0 USB device 003
Switched outlet 1 off
Switched outlet 2 off
Switched outlet 3 off
Switched outlet 4 off
Leave a Reply