It was previously working but I haven’t been using it for a while. Now I am trying to set it up again, but it doesn’t work. The log says:
The nut platform for the sensor integration does not support platform setup. Please remove it from your config.
I looked at the documentation (Network UPS Tools (NUT) - Home Assistant), and it says nothing about how to configure it in configuration.yaml. Instead, it says that I can do it from the Settings / Integrations menu. I don’t have that, supposedly because I am using configuration.yaml. Is there really no way I can configure NUT from configuration.yaml?
So, given the NUT add-on in Home Assistant Core is installed and working (mine is) and has a username and password configured, why doesn’t the HA NUT integration allow logging in via the username and password configured in the add-on?
If you have it set up previously using yaml, most likely configuration was migrated to UI and parts that you do once (user, password) are hidden from you, as integration is considered to be set up already. Have you tried to completely remove the integration (from UI and from yaml) and set it up again from scratch? First start process should give you opportunity to configure necessary paramenetrs.
Thank you, @mirekmal. That is exactly what I did to attempt to get it working. I backed up my configuration YAML from the add-on UI. Then I deleted the NUT add-on, and then deleted the NUT integration. Following this, I added back the add-on, configured the add-on, and then attempted to add the integration. Unfortunately, it still refuses to login/connect.
So seems at least you are able to configure it completely?
If this is log in failure there are other options to investigate:
are your credentials right? Have you checked any other NUT client with your UPS?
is UPS NUT server running? Myself I use NUT server on Synology NAS and I found that periodically it stops to work and need to be disabled and re-enabled again to be able to connect to.
It seems my Cyber-Power 1500 UPS powered down, and does not communicate over USB when powered down. After powering the UPS back ON, and stopping and restarting the NUT add-in, it shows the user being configured as contained in the add-on Configuration UI:
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] nut.sh: executing...
[13:39:42] INFO: Setting mode to netserver...
[13:39:42] INFO: Generating /etc/nut/upsd.users...
[13:39:42] INFO: Configuring user: fred
[13:39:42] DEBUG: Password SHA1: --some very long hex string--
Still, when attempting to configure the HA Integration, the login/connect fails. I cannot be certain, but I strongly suspect the NUT add-on isn’t mapping a TCP/IP port out to the host system as expected:
fred@hassio:~$ sudo docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
52b69b5b2ce9 ghcr.io/hassio-addons/nut/amd64:0.9.1 "/init" 9 minutes ago Up 9 minutes addon_a0d7b954_nut
4a28f51c5e3f ghcr.io/home-assistant/qemux86-64-homeassistant:2022.3.1 "/init" 2 days ago Up 2 days homeassistant
f3aec4b5be6b esphome/esphome-hassio-amd64:2022.2.6 "/init" 4 days ago Up 4 days addon_a0d7b954_esphome
@tom_l , sorry to tag you here but I noticed one of your screenshots included the NUT add-on so I was wondering if you might have some knowledge that may help us here…?
It’s ages since I set mine up and after reading your issues I’m a bit reluctant to delete the integration and set it up again. My NUT integration is configured to use localhost port 3493.
Looking through the issues on github others have had success using a0d7b954-nut instead of localhost as the host.
The reason I don’t allow the shutdown host command is that I have replaced the 7Ah battery of my UPS with an 18Ah model and there is no way to tell the el-cheap-o UPS this. So the capacity remaining calculations are way off and NUT shuts my server down too soon if I allow it.
I looked at the existing issues posted against the NUT Integration (Core HA one, not the Add-on) and found someone had posted the fix.
We need to use the add-on slug rather than ‘localhost’ when setting up the Integration. In the case of this add-on the slug is a0d7b954-nut. Use the rest of the settings you used in the add-on config such as the default port 3493 and the username and password you entered.