Using Nuon smart plug with Domoticz and Razberry

30 October 2013

Nuon (Dutch energy company) offers the Greenwave Power Node 1 and 6 as the smart plug and smart plug 6. Compared to other z-wave plugs they are very affordably priced. Nuon states that they work with their own Nuon e-manager device and app but they are standard z-wave devices and work just as well with Domoticz when you have a Razberry.

The smart plug is a switch and energy monitor in one. The smart plug 6 is able to switch and monitor the 6 sockets individually. I use the smartplug 6 to switch the appliances for my TV setup. I have connected the TV, reciever, HTPC, cable set-top box and network switch to the different sockets. I could have used a smart plug 1 but I don't need my reciever and HTPC to be powered when I only want to watch cable TV. With the smart plug 6 I can keep these off and only turn on the TV and the set-top box. I use the single smart plug to disconnect my computer setup when it's not in use.

Nuon smart plug 6 and 1 made by Greenwave

It's a bit of a lenghty post but I got this up and running within 15 minutes.

To use the smartplugs in Domoticz you'll need Domoticz running on a Raspberry Pi with the razberry installed. I have a seperate post on how to get that up and running. I assume you have this working for the rest of this post. I also assume that you are comfortable with working in the command line of linux.

First step is to get the smart plug included in your z-wave network. Open the razberry web interface in your browser. Pick the expert interface and select "network management" from the menu. Click the "(re-)include device" button to put the razberry in discovery mode. Plugin the smart plug and press the power button to turn on the smart plug. On the short side on the right of the power button is a small button. Press that to put the plug in include mode. The razberry and plug will now detect each other and plug will be included in the z-wave network.

If everything workes as it should you will now have 6 switches on de Devices control -> Switches page. Under "Sensors" you will find 6 energy consumption sensors. One for each of the sockets.

Razberry screenshot after adding the nuon smartplugs

Now we'll add those to Domoticz. Log-in in the web interface of Domoticz and open the Setup -> Devices page. You should see 12 new devices. I found that 2 energy monitors per socket where added. I added the devices with the type "Usage" by clicking the green button. You'll be prompted to enter a name.

To add the switches go to the switches tab in Domoticz and Devices control -> Switches in the Razberry interface. In Domoticz click the Learn Light/Switch button then go to the Razberry interface and click the On button for one of the switches. Go back to Domoticz and enter a name for the switch. Repeat this for all the 6 switches.

You will now have 6 switches and 6 energy monitors in Domoticz. The energy monitor however will not update in Domoticz automatically so you won't see any changes in energy consumption. We'll need to create a small script that will run in the background on the Raspberry Pi to update the status. Thanks to garp on the Domoticz forum to create and share this script. First we'll need to get the id of the smart plug from the Razberry. It's the number in front of the switches on the Devices control -> Swtiches screen. For me it's 3 yours can be different.

Create a new document with a text editor and copy-paste this code. Replace the 3 in devices[3] with your id. Save the file somewhere on your computer with the extension .sh. I named the file This example contains both the single smart plug and the smart plug 6.

# Nuon Smart Plug (Greenwave Powernode) update script
# for use on a Raspberry Pi with a Razberry installed
# Replace the number in devices[3] with the id of your device
# Save the script and use crontab -e to run it at set intervals

# Smart plug 6 energy meter update
wget --quiet "[3].instances[0].Meter.Get()" -O /dev/null
sleep 2s
wget --quiet "[3].instances[1].Meter.Get()" -O /dev/null
sleep 2s
wget --quiet "[3].instances[2].Meter.Get()" -O /dev/null
sleep 2s
wget --quiet "[3].instances[3].Meter.Get()" -O /dev/null
sleep 2s
wget --quiet "[3].instances[4].Meter.Get()" -O /dev/null
sleep 2s
wget --quiet "[3].instances[5].Meter.Get()" -O /dev/null
sleep 2s
wget --quiet "[3].instances[6].Meter.Get()" -O /dev/null
sleep 2s

# Single smart plug energy meter update
wget --quiet "[2].instances[0].Meter.Get()" -O /dev/null
sleep 1s

Copy the file to your Raspberry Pi. I use WinSCP (Windows) or Cyberduck (OSX) for this. Place the file in the scripts directory within the domoticz directory. By default this will be /home/pi/domoticz/scripts. No press ctrl-p to open putty and login.

We'll need to add this script to cron so it will run in the background. Enter crontab -e in the console. This will open the cron file to edit. I run this script every minute so I entered:

* * * * * sh ~/domoticz/scripts/

You can change the interval if you like and if you named your file differently you'll need to replace with the correct filename. Save the file and exit the editor and console. Make sure that you're logged in as the user pi and don't run crontab -e as root.

That's it. You'll now see the energy consumption updated every minute in Domoticz and you can switch on and off all 6 of the sockets individually. Have fun!