Trying to install the nut integration in HACS

I have installed the nut package on my Ubuntu 20.04 system and believe I have it configured correctly. I can do a upsc command and see the attributes of my UPS. I have nut-server and nut-client running although there’s an issue with the pid file:

sudo service nut-client status
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
     Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2020-07-29 14:08:35 CDT; 11min ago
    Process: 11220 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS)
   Main PID: 11223 (upsmon)
      Tasks: 2 (limit: 19067)
     Memory: 1.0M
     CGroup: /system.slice/nut-monitor.service
             ├─11221 /lib/nut/upsmon
             └─11223 /lib/nut/upsmon

Jul 29 14:08:35 automation-server systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...
Jul 29 14:08:35 automation-server upsmon[11220]: fopen /run/nut/upsmon.pid: No such file or directory
Jul 29 14:08:35 automation-server upsmon[11220]: UPS: serverups@localhost (master) (power value 1)
Jul 29 14:08:35 automation-server upsmon[11220]: Using power down flag file /etc/killpower
Jul 29 14:08:35 automation-server systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: Operation not permitted
Jul 29 14:08:35 automation-server upsmon[11221]: Startup successful
Jul 29 14:08:35 automation-server systemd[1]: nut-monitor.service: Supervising process 11223 which is not our child. We'll most likely not notice when it exits.
Jul 29 14:08:35 automation-server systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.

Ok, now to the problem. When I attempt the integration install in HACS, it opens a dialog and asks for hostname, port, user, and password. I put those in and I just get “Unknown error occurred” at the top of the dialog.
Looking in the home-assistant.log file, I see one of these for each attempt to integrate:

2020-07-29 14:13:02 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 145, in post
    return await super().post(request, flow_id)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 106, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 153, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 201, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/nut/config_flow.py", line 174, in async_step_user
    if self._host_port_alias_already_configured(self.nut_config):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/nut/config_flow.py", line 216, in _host_port_alias_already_configured
    existing_host_port_aliases = {
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/nut/config_flow.py", line 217, in <setcomp>
    _format_host_port_alias(entry.data)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/nut/config_flow.py", line 106, in _format_host_port_alias
    host = user_input[CONF_HOST]
KeyError: 'host'

Has anyone seen and solved this problem before?

Which integration did you install with hacs? I can’t see any nut ones.

Sorry, it wasn’t HACS. It was straight from Home Assistant.

What did you enter as host?

I tried both localhost and 127.0.0.1. Both failed the same way.

The nut-server is running on the same computer as home assistant.

And what address is nut listening on? netstat -tanp|grep LISTEN

It’s configured for 3493 which is what I put in the configuration dialog.

netstat -tanp|grep LISTEN
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp        0      0 [127.0.0.1:6010](http://127.0.0.1:6010/)          0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:5050](http://0.0.0.0:5050/)            0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:8123](http://0.0.0.0:8123/)            0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:1883](http://0.0.0.0:1883/)            0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:445](http://0.0.0.0:445/)             0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:514](http://0.0.0.0:514/)             0.0.0.0:*               LISTEN      -
tcp        0      0 [127.0.0.1:3493](http://127.0.0.1:3493/)          0.0.0.0:*               LISTEN      -
tcp        0      0 [127.0.0.1:3306](http://127.0.0.1:3306/)          0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:139](http://0.0.0.0:139/)             0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:111](http://0.0.0.0:111/)             0.0.0.0:*               LISTEN      -
tcp        0      0 [127.0.0.53:53](http://127.0.0.53:53/)           0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:22](http://0.0.0.0:22/)              0.0.0.0:*               LISTEN      -
tcp        0      0 [127.0.0.1:47031](http://127.0.0.1:47031/)         0.0.0.0:*               LISTEN      -
tcp        0      0 [127.0.0.1:631](http://127.0.0.1:631/)           0.0.0.0:*               LISTEN      -
tcp        0      0 [127.0.0.1:8088](http://127.0.0.1:8088/)          0.0.0.0:*               LISTEN      -
tcp        0      0 [0.0.0.0:25](http://0.0.0.0:25/)              0.0.0.0:*               LISTEN      -
tcp6       0      0 ::1:6010                :::*                    LISTEN      -
tcp6       0      0 :::1883                 :::*                    LISTEN      -
tcp6       0      0 :::445                  :::*                    LISTEN      -
tcp6       0      0 :::514                  :::*                    LISTEN      -
tcp6       0      0 :::139                  :::*                    LISTEN      -
tcp6       0      0 :::111                  :::*                    LISTEN      -
tcp6       0      0 :::8086                 :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:631                 :::*                    LISTEN      -
tcp6       0      0 :::3000                 :::*                    LISTEN      -
tcp6       0      0 :::25                   :::*                    LISTEN      -

Ok it is listening on 127.0.0.1 then.

Not sure where ro go next, except to say there are some other threads on this.