Help setting up NUT component

So I’d like to see the UPS status and Battery status of the UPS in Home Assistant and came across the NUT component.
Mind you that I already installed the NUT server in the past so it’s already running on the same pi!

pi@hassbian:~ $ sudo /etc/init.d/nut-client status
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
   Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled)
   Active: active (running) since Fri 2017-03-17 16:06:39 CET; 2 weeks 6 days ago
 Main PID: 813 (upsmon)
   CGroup: /system.slice/nut-monitor.service
           ├─812 /lib/nut/upsmon
           └─813 /lib/nut/upsmon

Now when I added the NUT component in HASS with:

- platform: nut
  resources:
    - ups.load
    - ups.realpower.nominal
    - input.voltage
    - battery.runtime

I get the following error when starting HASS:

17-04-06 22:45:22 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.nut
17-04-06 22:45:22 ERROR (Thread-9) [homeassistant.components.sensor.nut] Failure getting NUT ups alias, Socket error.
17-04-06 22:45:22 ERROR (Thread-9) [homeassistant.components.sensor.nut] NUT Sensor has no data, unable to setup.

What am I doing wrong?

Anyone has any idea?

Have you tested running the upsc command on the command line? What port is your NUT server running on? Default is 3493.

upsc -l

When I run that command it says:

pi@hassbian:~ $ sudo upsc -l
Error: Connection failure: Connection refused

Mind you that I already installed NUT on my pi like this:

On the raspberry you need to install NUT
sudo apt-get install nut

edit the monitoring config
sudo nano /etc/nut/upsmon.conf

Scroll down to the part MONITOR 
# MONITOR [email protected] 1 upsmon secretpass slave
# MONITOR myups@localhost 1 upsmon pass master  (or slave)

and add below:
MONITOR [email protected] 1 monuser secret slave

Change the IP to the IP of your NAS. All the other info suitable for every Synology NAS
Save the file and quit nano

Edit nut configuration
sudo nano /etc/nut/nut.conf

Change MODE=none into
Code: Select all
MODE=netclient
Save the file and quit nano

Start monitoring the remote UPS server
sudo /etc/init.d/nut-client start

When I then run this command:
sudo /etc/init.d/nut-client status
it returns that it’s running fine:

pi@hassbian:~ $ sudo /etc/init.d/nut-client status
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown co                            ntroller
   Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled)
   Active: active (running) since Fri 2017-03-17 16:06:39 CET; 1 months 8 days a                            go
 Main PID: 813 (upsmon)
   CGroup: /system.slice/nut-monitor.service
           ├─812 /lib/nut/upsmon
           └─813 /lib/nut/upsmon

Might the automatic NUT setting up of HASS somehow interfere with my already installed NUT service?
Is there a way to just “read” that status and show it in HASS somehow?

The HASS component doesn’t modify anything on your installed service. It looks like you aren’t running the NUT server component on you PI, just the client. You need the server part to allow HASS to fetch the data.

1 Like

I followed this guide:
http://wynandbooysen.com/raspberry-pi-ups-server-using-nut.html

Like @mezz64 says, you’re missing the server config in nut.conf and upsd.conf, and you should also config driver in ups.conf.

Also @mezz64: Ok I understand what I did wrong now. I thougt pi3 runs the server but of course that’s not true!
My Synology NAS runs the server and indeed pi3 NUT is just a client.
I now used the Synology NAS ip address as host in the HASS NUT component and…tada works right away! :).

Luckily it was not needed to setup a new NUT server :).
Thanks both of you for helping me think in the right direction!

So i have this setup and working but some of the variables dont work. I have a apc back-ups pro 1500. Im trying to get the current wattage load but the variable on their site is not working…

ups.realpower

Any ideas?