Note: the issue that required using the setup method described below was fixed in 0.108.7. If you’re running that version or later, these steps shouldn’t be necessary.
We’re in the process of migrating from Domoticz to Home Assistant, and one of the major reasons for doing so is HA’s NUT integration. We live in a part of the world that is prone to what I will kindly refer to as ‘power events’, which means that having effective monitoring, event response, and historical tracking of what the UPSes are up to is rather important for us.
The layout of the property being what it is, all of the UPSes are connected via USB to RasPi Zero Ws. The RasPis are running NUT in netserver mode, which makes them perfect for remote monitoring. Unfortunately, this is a scenario that HA’s NUT documentation doesn’t really cover. I’ve been able to trial-and-error my way through addressing this, and now have a NUT integration in HA with multiple remote NUT instances being monitored; a single remote NUT server can also be monitored using this method. Home Assistant 0.108.3 was the version in use at the time of writing.
First things first: install the NUT integration in HA. This lives in the community repo (https://addons.community), so you’ll need to have that configured in order to pull NUT from the Add-On Store.
Once that’s taken care of, do not start NUT. There are two pieces of pre-configuration that need to take place:
First, change the NUT add-on’s config to the following:
users:
- username: foo
password: bar
instcmds:
- all
actions: []
devices:
- name: Dummy UPS
driver: dummy-ups
port: /dev/null
config: []
mode: netclient
shutdown_host: 'false'
remote_ups_host: a0d7b954-nut
remote_ups_name: upsmon on localhost
remote_ups_user: remote_monitoring_username
remote_ups_password: remote_monitoring_password
Note that the ‘mode’ option above is set to ‘netclient’. This will cause the ‘users’ and ‘devices’ configuration sections to be ignored. In the example above, they’re set to safe fake values.
Having said that, the remote_ups_user and remote_ups_password options do need to be changed. Set those to the username and password that your remote NUT instances use for their monitoring login.
Next, in configuration.yaml, create sensors for your remote UPSes:
sensor:
- platform: nut
name: friendly_name_01
host: ip_address_or_hostname_of_remote_NUT_instance
port: 3493
username: remote_monitoring_username
password: remote_monitoring_password
resources:
- ups.load
- ups.status
- input.voltage
- battery.runtime
- platform: nut
name: friendly_name_02
host: ip_address_or_hostname_of_remote_NUT_instance
port: 3493
username: remote_monitoring_username
password: remote_monitoring_password
resources:
- ups.load
- ups.status
- input.voltage
- battery.runtime
- platform: nut
name: friendly_name_02
host: ip_address_or_hostname_of_remote_NUT_instance
port: 3493
username: remote_monitoring_username
password: remote_monitoring_password
resources:
- ups.load
- ups.status
- input.voltage
- battery.runtime
Change the ‘name’, ‘host’, ‘username’, and ‘password’ options to reflect your environment. If you’re only monitoring one remote UPS, the extra two ‘platform’ sections can be removed, or more added as necessary if you have more than three devices to monitor.
Once this is complete, go ahead and start the NUT add-on. You should now have notifications to the effect of new entities being available for configuration, which are your remote NUT instances. There should also be a NUT integration visible for each remote NUT instance that was added.
Hopefully this is helpful for someone else - it’s not intuitive as to how to address this scenario in HA, but it is definitely doable.