palfrey/ban_allowlist

Error during setup of component ban_allowlist

Closed this issue · 3 comments

Hello,
Thank you for your project, but impossible to add it on my HA ... :/
Can you please help ?

PS : Possible to add IP range feature ?

Error during setup of component ban_allowlist
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/ban_allowlist/__init__.py", line 33, in async_setup
    ban_manager: IpBanManager = hass.http.app[KEY_BAN_MANAGER]
                                ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 194, in __getitem__
    return self._state[key]
           ~~~~~~~~~~~^^^^^
KeyError: <AppKey(homeassistant.components.http.ban.ha_banned_ips_manager, type=ForwardRef('IpBanManager'))>

Which version? What exactly did you do to install it?

IP range feature can be added. Patches welcomed, as I've got no need for it myself, but will accept PRs that add it.

Installation via HACS

Core
2024.5.2
Supervisor
2024.04.4
Operating System
12.2
Frontend
20240501.1

Fixed by #2 / v0.2. Well, the exception won't turn up anymore, but now you'll have a warning flagging you didn't set http.ip_ban_enabled to True, without which this doesn't work. It's a filter on top of the existing ban list work.