Shell Interface

With this 'interface' you can run a binary or shell script and either:
  • parse the results, these result values will be put in the value fields of the device.
  • or have DomotiGa call the script with 'On' or 'Off' to have the script set the device

For importing values, the tool or the script should return one or more values separated by newlines:

$ /usr/local/bin/upnp2mrtg

See the examples below:


First things to do is to enable the Shell module under Interfaces -> Shell:

Next step is to one or more add devices:
  • Device Id assigned by Domotiga
  • The Name string will be used in the Device overview and must be unique
  • The Type must be set to Shell
  • Device and Interface will be automatically set
  • Put in the Command field the command, optionally with arguments, to execute
  • Icon On/Dim/Off gives the icon Domotiga will show in the Device overview window

For switching (or dimming) devices, go to the Options tab of the device and enable either "Device can be switched" or "Device can be dimmed"



For example to measure internet traffic flowing through a Fritz!Box you can set it up as follow:

Create device "Internet Traffic"
Devicetype "Shell"
As address put in the script/command to run, in this case: /usr/local/bin/upnp2mrtg

Warning: If you use a newer FritzOS version on your router (and you should!) the link below downloads an incompatible script, if you use this it will fail to download the data from the Fritz!Box and you end up with a device and 46 values attached ;-)

Use the upnp2mrtg script attached to this wiki page instead.

You can install and test it from the shell like so:

$ cd ~install
$ wget
$ chmod +x upnp2mrtg
$ sudo cp upnp2mrtg /usr/local/bin
$ /usr/local/bin/upnp2mrtg
7 days 22:38:11 h (online)

There should be no need to change the script, it should find your Fritz!Box automatically.

Update (June 2014): A recent version of the Fritzbox Firmware breaks the upnp2mrtg script and may cause the
script to report http 500 internal server error instead of the traffic values. Fortunately the resolution is
quite simple. Edit the /use/local/bin/upnp2mrtg file, and in the request_header function, change
echo "POST /upnp/control/$4 HTTP/1.0
echo "POST /igdupnp/control/$4 HTTP/1.0
i.e. insert igd after the first / and before upnp

If you want to graph you Internet Traffic values
Tick Log RRD data on device tab Graphs.
Name DataSource Name Value1 "download" and select type COUNTER
Name DataSource Name Value2 "upload" and select type COUNTER

You can now define a Extended graph, to display your Incoming and Outgoing traffic.

Go to Edit Graphs
Create new one for example "Internet Traffic"
Fill in new Name and Title, click on Save, reopen it.

Click tab Graph Data
Select ID 1
Name Download
DS Internet Traffic download
Type LINE1 Color <your color>

Click Save

Select ID 2
Name Upload
DS Internet Traffic upload
Type LINE2 Color <your color>

Click Save

Click tab Groups
Put it in group Network

Click Save

You can click on Preview to see if it looks ok.


SNMP monitoring

You can also create a custom script to get other values, for example SNMP,

Monitor a Synology NAS with SNMP

First enable SNMP first on a Synology (under Network Settings/SNMP)

# example script to get snmp values in DomotiGa device fields

value1 = `snmpwalk ...`
value2 = `snmpwalk ...`
value2 = `snmpwalk ...`

echo value1
echo value2
echo value3

After this test simply do this:

Enable Shell Interface
Check polltime to run.
NOTE: this time is the same for all devices of type Shell Value.

On the next run, the values of the device should be filled.
It take each line and put it in a value, so line1 = value1, line2 = value2 etc.

snmpwalk output regarding memory:

iso. = STRING: "Physical memory" 
iso. = STRING: "Virtual memory" 
iso. = STRING: "Memory buffers" 
iso. = STRING: "Cached memory" 
iso. = STRING: "Swap space" 
iso. = STRING: "/" 
iso. = STRING: "/volume1" 
iso. = STRING: "/volume1/myhome" 
iso. = INTEGER: 1024
iso. = INTEGER: 1024
iso. = INTEGER: 1024
iso. = INTEGER: 1024
iso. = INTEGER: 1024
iso. = INTEGER: 4096
iso. = INTEGER: 4096
iso. = INTEGER: 4096
iso. = INTEGER: 515556
iso. = INTEGER: 2612636
iso. = INTEGER: 515556
iso. = INTEGER: 249828
iso. = INTEGER: 2097080
iso. = INTEGER: 612766
iso. = INTEGER: 1078116418
iso. = INTEGER: 1078116418
iso. = INTEGER: 502304
iso. = INTEGER: 502304
iso. = INTEGER: 68084
iso. = INTEGER: 249828
iso. = INTEGER: 0
iso. = INTEGER: 134322
iso. = INTEGER: 1076977576
iso. = INTEGER: 1076977576
iso. = INTEGER: 768
iso. = INTEGER: 1025
iso. = INTEGER: 1026
iso. = INTEGER: 1536
iso. = INTEGER: 1537
iso. = INTEGER: 1538
iso. = INTEGER: 1539
iso. = INTEGER: 1552
iso. = INTEGER: 1553
iso. = INTEGER: 1554
iso. = INTEGER: 1555
iso. = INTEGER: 1568
iso. = INTEGER: 1569
iso. = INTEGER: 3072

Switch device

If you have devices not supported by DomotiGa natively, but you have a script to control them with you can do the following.

Create a script, for example ""

$ vi /home/ron/domotiga/scripts/

stty -F /dev/ttyACM0 9600 2>/dev/null
if [ $1 == 'On' ]
  echo -e '\xff\x01\x01' > /dev/ttyACM0 2>/dev/null
  echo 'On'
  echo -e '\xff\x01\x00' > /dev/ttyACM0 2>/dev/null
  echo 'Off'

Make the script executable:

$ chmod +x

Create a Shell device in DomotiGa, set the address to the absolute path of this script.
Make it switchable in the device options.

Now you can control it by clicking the button on the Control page, and the scripts get's called with argument "On" or "Off".

The shell script needs to/can report back the status as well, here done with the echo 'On/Off's.

This example switches relais 1 of a KMtronic 8 channel relais card.


    Updated by: rdnzl, Updated over 2 years ago
    Access count: 67176 since 2011-11-13

    Attached Files

    shell-device.png (56.9 KB) rdnzl, 05/08/2012 07:50 PM

    internet-traffic.png (20.5 KB) rdnzl, 05/08/2012 07:50 PM

    KMtronic_Relais.jpg (32.2 KB) rdnzl, 11/27/2012 01:15 PM

    Shell_settings.png (18.2 KB) danfos, 09/21/2014 04:09 PM

    Shell_device.png (42.9 KB) danfos, 09/21/2014 04:11 PM

    upnp2mrtg - Compatible with newer FritzOS versions (5.52 KB) rdnzl, 11/21/2014 10:18 AM

    Also available in: PDF HTML TXT