Lazy Man Joe's Ramblings


January 2019

Adding a NUT [Network UPS Tools] sensor to

So in my previous post I showed how to add NUT to Ubuntu and XigmaNAS – with this all working the next step is to add a NUT sensor to

I’m running Home-Assistant in a Docker container, but previously had it running on a Raspberry Pi (using – I will post how I moved from RPi to Docker in future.


It’s fairly easy and you only have to add the following lines to your home-assistant configuration.yaml file:

under the sensors section

- platform: nut
name: Eaton UPS
port: 3493
alias: EatonUPS
username: mynas
password: your_password_goes_here
- ups.load
- ups.realpower.nominal
- input.voltage
- battery.charge
- battery.runtime
- ups.delay.shutdown

The username & password settings are the ones you configured when you set up NUT on Ubuntu.

Reload/restart Home-Assistant to make sure the config is updated.

This is what I get:

screenshot 2019-01-07 at 18.20.08

That’s it !

This sensor attributes are now available on your Home-Assistant to query and use in Node-Red flows, etc. !

screenshot 2019-01-07 at 18.27.30


Have fun !


Setting up an Eaton 5E650iUSB UPS on Ubuntu [master] & XigmaNAS [slave] with USB monitoring using NUT [Network UPS Tools]

We’re running 2 “old” HP N40L Microservers at home and they’ve been working great for the last few years [I think I got them in 2011 !]

The one is running XigmaNAS  [a free NAS based on FreeBSD] and the other is running Ubuntu 18.10 [we use this to run a few Docker containers].

As we’ve been experiencing so-called “Load-shedding” again in South Africa in the last couple of months, it is imperative to have some sort of backup power to allow the servers to shutdown in a controlled manner [I’ve lost a drive on the NAS in the past due to multiple power outages/spikes :-(]

I purchased an Eaton 5E 650i UPS which has a USB interface.

I’m using the UPS on the Ubuntu machine as the “master” and on XigmaNAS, I’ve configured it as a “slave” – this means when the power goes out and the UPS is running low on battery, the “slave” will shutdown 1st and then the “master”.

Here are the steps I followed to make this work:

Step 1 – install NUT

You can find information on NUT [Network UPS Tools] on their website.

Basic step is:

sudo apt-get install nut

Step 2 – Configure

Driver setup – UPS.CONF

Now you need to configure the /etc/nut/ups.conf file
By default this file does only contains samples [in comments]
Add the following:
    driver = usbhid-ups
    port = auto
    vendorid = 0463
    pollfreq = 30
    desc = "Eaton UPS on MyServer"
For the Eaton UPS, the driver is listed as usbhid-ups on the NUT compatibility site
port is auto for USB
I had to get the vendorid as it would not start up without specifying it.
Vendorid was checked with the following command – lsusb:
$ lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 005: ID 0463:ffff MGE UPS Systems UPS
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
So when you configure it for yourself, you can confirm the vendor ID for your own device using the lsusb command.

User access – UPSD.USERS

Now you have to configure the users who can access the service – edit the /etc/nut/upsd.users file
[upsmon]password = "your_password_goes_here"
upsmon master

password = "your_password_goes_here"
upsmon slave

password = "your_password_goes_here"
actions = SET
instcmds = ALL
password – your password
and then tell upsmon whether it will be the master or slave user [slave for other ups monitoring on the network]
The [admin] user is for some UPS specific settings changes [like beeper disable – see later]

Allow for multiple monitoring points – NUT.CONF

Configure NUT as netserver – so multiple devices [like LazyNAS] can also monitor it
Edit the /etc/nut/nut.conf file and set mode to netserver [if only for local, you would make it standalone]
You now need to let the UPSD service know on which network interfaces to listen – edit /etc/nut/upsd.conf
Localhost is and our internal network interface is

TEST your configuration

Ok now to start all the stuff !
Run this command
sudo upsdrvctl start
Results when successfully started:
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Using subdriver: MGE HID 1.39
Then the moment of truth for checking the status:
Use the upsc command to connect to the service and get info on the EatonUPS UPS
upsc EatonUPS@
Init SSL without certificate database
battery.charge: 100
battery.runtime: 1192
battery.type: PbAc
device.mfr: EATON
device.model: 5E 650i
device.type: ups usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.parameter.vendorid: 0463
driver.version: 2.7.4 MGE HID 1.39
driver.version.internal: 0.41
input.voltage: 241.0
outlet.1.status: on
outlet.desc: Main Outlet 1
outlet.switchable: no
output.frequency: 49.9
output.frequency.nominal: 50
output.voltage: 238.0
output.voltage.nominal: 230
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: 03.08.0018
ups.load: 26
ups.mfr: EATON
ups.model: 5E 650i
ups.power.nominal: 650
ups.productid: ffff
ups.start.battery: yes
ups.status: OL
ups.timer.shutdown: -1
ups.vendorid: 0463
Success ! 🙂

Step 3 – Disabling the BEEPER !

By default the beeper is set to ENABLED.
It will beep on start-up and on loss of power AND when it’s about to shutdown – NOISY !!!
So to check the current beeper status, you can run this command [on the localhost]:
upsc EatonUPS ups.beeper.status
To change the status to DISABLED, use the upscmd utility:
upscmd EatonUPS beeper.disable
Username (lazyserver): admin
This would use the user [admin] /password created in the /etc/nut/upsd.users file earlier
Now the status will be disabled & it won’t disturb you when the power goes out in the middle of the night !

Step 4 – Configure XigmaNAS to also monitor this UPS as a slave device

XigmaNAS has a UPS option under Services -> UPS
screenshot 2019-01-06 at 16.25.09
Configure the following:
Mode: Slave
Identifier: EatonUPS    [this is the name as defined on the Ubuntu machine (lazyserver) for the UPS]
IP Address: [this is the ip address of the machine with the UPS linked to via USB]
Shutdown mode: UPS reaches low battery   [ to ensure it will only shutdown after it’s been on UPS for a while & power did not come back]
Username: mynas  [as defined in the /etc/nut/upsd.users file]
Password: your_password_goes_here  [as defined in the /etc/nut/upsd.users file]
Enable the service (tickbox & save & restart) and check the logs to confirm it is working.
On homepage, you should see status in UPS section at the bottom
screenshot 2019-01-06 at 16.28.33
For more detail you can click on the “Show UPS Information” link and you will see all the detail:
screenshot 2019-01-06 at 16.29.58
That’s it !
Next steps would be to configure XigmaNAS to send you emails, etc. – but that’s standard functionality when you setup XigmaNAS – so not covered here.


The following links helped a lot with my setup.

Setting up a DuckDNS Docker Container to handle dynamic IPs for your home server


We have a fibre connection at home and like most of the home setups, you will be assigned a new external IP address every time your router re-connects, or when your lease is renewed by your ISP (whenever they feel like it :-))

As we want to expose some of our internal server(s) [Docker containers] to the outside world, and be able to access it via a URL which we know, we’ve in the past opted to use The free version of allows for up to 3 hosts to be configured, on one of the domain names they offer – like (just an example).

If you want to use your OWN domain, then you need to purchase a PLUS DNS Management package.

ENTER – ! is a free service (running on AWS) which allows for the creation of known URLs linked to your dynamic IP address (similar to

You will typically get a URL like – BUT you can update that (via your domain registrar/DNS provider) to point to your own configuration – like

You still need to update your IP address with DuckDNS to make sure it has the latest IP address assigned to you and this is where the DuckDNS Docker container comes in handy.


Ok, after that long-winded intro here is how I configured the following domain – to point to a locally hosted WordPress container (running on Docker) and hosting my wife’s blog.

Step 1 – Setup a DuckDNS Account

Go to
Register to get access [Free]
Once registered, you will get an access token assigned to your account.
You can now also select to add a unique sub-domain to and link it to your account.
We added to my account.
screenshot 2019-01-05 at 16.16.34

You also have the option on this screen to manually update the external IP address assigned to you by your ISP.

You now have a URL ( which points your IP assigned to your router. (although at this point it probably won’t do anything as you still have to configure a couple of other things to make it all work)

Step 2 – Docker container for DuckDNS updates

As your IP address assigned to you by your ISP changes all the time, you need to let know about these changes to make sure that the IP on their side always resolves correctly to your environment.

Fortunately there is a docker container to assist with this.

Check to see the DuckDNS container maintained by the team [they do some AWESOME stuff ! – I’m using some other containers maintained by them and will cover this in later posts]

NOTE: I won’t go into how to get Docker installed in this post and assume you already have docker up and running.

So from the command line, I used the following to pull the latest DuckDNS container and creating it on Docker:

docker create –name=duckdns –restart unless-stopped \
-e TZ=Africa/Johannesburg \
-e SUBDOMAINS=greystormydesigns \
-e TOKEN=*******-****-****-****-***** \

Let’s unpack that a bit:

name = this is the name of your container for your own reference

–restart unless stopped = this tells docker to restart the container if something goes wrong, except if you specifically stopped it

-e TZ = sets the timezone

-e SUBDOMAINS= this is the important bit for DuckDNS – it let’s them know which domain you want to update – you only specify the 1st bit (

-e TOKEN= this needs to be your token assigned to your account when you registered

and then lastly the name of the container to pull from – linuxserver/duckdns

With all this done, the docker container should be created and ready to be run.

All you now have to do is run the container on docker and it will update the IP address on every 5 minutes.

A typical start-up log will look like this:

          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/
Brought to you by
We gratefully accept donations at:
User uid:    ***
User gid:    ***
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 40-config: executing...
Retrieving subdomain and token from the environment variables
log will be output to docker log
Your IP was updated at Sat Jan 5 16:47:04 SAST 2019
[cont-init.d] 40-config: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

So that’s it – you now have a docker container running which updates your dynamic IP address on every 5 minutes.

We’re almost there – just a couple of small things to complete !

Step 3 – Update you router to allow for port-forwarding to your locally hosted website

Port-forwarding can be tricky (and risky), so please be careful with this setting if you’re not 100% sure what you’re doing. 🙂

I suggest you search google for instructions on configuring port-forwarding on your specific router.

Please note that most routers have this option and you would not have to buy anything …

I have an Asus Router and configured the port-forwarding on the WAN side – pointing to my internal server ( on port 8080.

So this rule routes all external port 80 calls to the internal network to a server running on port 8080

screenshot 2019-01-05 at 17.00.30

Step 4 – Update the CNAME-record on your domain DNS to point to the configuration

As you now have a subdomain ( pointing to you server, you can add a CNAME record on your DNS provider link these together.

I registered our domain on and from the configuration panel, I updated the CNAME Alias entry and added www pointing to

screenshot 2019-01-05 at 17.09.43

That’s it !

All should work fine now.

Hitting should open the Blog site 🙂

I hope this helps someone in future and that they will support the efforts of the team by donating to them !

Have fun !


Blog at

Up ↑