<< back to showcase of the Download Station

Plasmoid for USB power outlet strip

Gembird's Silver Shield power outlet strip: to control with Linux (KDE4) from the desktop. By means of the plasmoid USB-Steckdose.
... more [download as ZIP]
Bild: Screenshot von Plasmoid USB-Steckdose

What is this plasmoid for?

The plasmoid "USB-Steckdose" allows you to click icons at the desktop to switch the sockets of your power outlet strip (Revolt INtelli-Plug, Gembird SIS-PM, 4 sockets) on and off. The icons show the states of the sockets (on/off).

You should have installed

  1. Linux, KDE4 --- the plasmoid was developed on Debian Squeeze, KDE 4.4. Other distributions were not tested, but should work as well.

  2. Outlet strip:
    • A USB power outlet strip (Revolt INtelli-Plug, Gembird SIS-PM).
    • The programm: sispmctl (http://sispmctl.sourceforge.net).
    • Both plugged and installed in a full functional way. For exemple, it should be possible to work in the terminal as root with
      sispmctl -o 1

  3. The programm/package: sudo.
    In /etc/sudoers (to edit only with the command "visudo", not in an ordinary editor!!! Read the man-page of visudo!!!) should be a line like:
    username ALL=NOPASSWD: /usr/bin/sispmctl
    Take care of writing this line behind other lines as for exemple
    root ALL=(ALL) ALL
    because order of the line is relevant in processing /etc/sudoers! After this it should be possible to run
    sudo sispmctl -o 1
    as non-root user in the terminal.

  4. Other programs/packages:
    • debian package "plasma-scriptengine-python" (packages.debian.org/squeeze/plasma-scriptengine-python)
    • Therefor you need "phython" and "python-kde4" what is normally already installed. Otherwise it will be installed automatically while installing "plasma-scriptengine-python".

To get the plasmoid work

  1. Unpack "steckdose-plasma.zip" in your home folder, e.g. run in the terminal in your home folder:
    unp steckdose-plasma.zip
  2. Install the plasmoid with "plasmapkg":
    plasmapkg -i steckdose-plasma/
  3. Add the plasmoid as an plasma applet to the desktop:
    1. Push the right mouse button on the empty desktop
    2. Add applet ...
    3. Drag and drop the "USB-Steckdose" onto the Desktop

Problem solving

To use the plasmoid

  1. The icons show the state of evey socket of your power outlet strip, that means ON or OFF.
  2. Click at one icon, to switch the socket, that means OFF or ON.
  3. If you switch the socket by other means than this plasmoid (e.g. another programs or via terminal) the state of the buttons will be automatically updated after 5 seconds.

To customize the plasmoid

Deinstall the plasmoid: plasmapkg -r steckdose-plasma/
Edit the source code. Reinstall the plasmoid.

  1. If you want to change the icon in the control panel of the plasma applet:
    In steckdose-plasma/metadata.desktop:
    - adapt the line "Icon=/salz-on.png"

  2. If you want to change the time intervall (5 seconds) of the automatic updates:
    In steckdose-plasma/contents/code/steckdosen.py:
    - adapt "RefreshInMilliSekunden=5000" in section "1.FIXME"
    Shorter intervalls (z.B. 500) could lead to a high system load caused by the sudo calls!

  3. If you need to change the assignment without changing the buttons:
    In steckdose-plasma/contents/code/steckdosen.py:
    - adapt the string variables of the socket (=Steckplatz) in section "2.FIXME"

  4. If you want to change the images of the buttons:
    In steckdose-plasma/contents/code/steckdosen.py:
    - adapt the paths of the icons in section "3.FIXME"
    Parameter of the icons: 100x100 Pixel, resolution: 72x72 Pixel/Inch

  5. If you need less sockets, because your outlet strip has less sockets:
    Remove or adapt the source code of steckdose-plasma/contents/code/steckdosen.py:
    - delete/adapt the global variables
    - delete/adapt string variables of the socket (=Steckplatz)
    - delete/adapt the paths of the images
    - delete/adapt the position of the icons in the widget
    - adapt the function changeXyzZustand
    - adapt the buttons in initExtenderItem
    - adapt/delete the functions clicked1, clicked2, ...
    - adapt the function dataUpdated

Plasmoid test runs

An easy way to actually work on the source code of steckdose-plasma/contents/code/steckdosen.py and steckdose-plasma/metadata.desktop would be:
  1. Close all instances of the plasmoid on the desktop and deinstall the plasmoid with "plasmapkg":
    plasmapkg -r steckdose-plasma/
  2. Edit the source code and reinstall the plasmoid with "plasmapkg":
    plasmapkg -i steckdose-plasma/
  3. Have a look at the plasmoid with "plasmoidviewer" instead of adding it to the desktop over and over again:
    plasmoidviewer steckdose-plasma/
    In addition you'll get if necessary all the error messages on the terminal.

Even more easy: Each time after editing and saving the changed source code you run this one-line-command in your terminal/bash:
plasmapkg -r steckdose-plasma/ && plasmapkg -i steckdose-plasma/ && plasmoidviewer steckdose-plasma/

Useful internet addresses

About plasma and python: techbase.kde.org/Development/Tutorials/Plasma

This plasmoid revised and adapted for debian jessie from Rainer Dorsch in 2015: netcup.bokomoko.de/~rd/steckdose-plasma.tgz

Author

The script steckdosen.py was written by Annette Huck (annette at hopfenwiesen dot de). The pictures lampen-on.png, lampen-off.png, glaskugel-on.png, glaskugel-off.png, salz-on.png, salz-off.png, klavier-on.png, klavier-off.png, update.png, update-jetzt.png were drawed by Annette Huck (annette at hopfenwiesen dot de) with Gimp 2.2/2.6. This README was translated by Annette Huck.

License

Copyright 2011 Annette Huck.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.