core: Can not toggle UniFi Network switch entities: BlockUnifiDeviceForbidden

The problem

as title, when trying to toggle any of the network switches on wifi Unifi cameras, this error is returned

What version of Home Assistant Core has the issue?

2022.10.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

UniFi Network

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifi/

Diagnostics information

please let me know if this is required, because the diagnostics seem to contain a lot of private info…

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-10-19 11:28:19.198 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140430232107808] api.err.BlockUnifiDeviceForbidden
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 202, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 207, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 355, in async_turn_off
    await self.controller.api.request(
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 211, in request
    response: list[dict[str, Any]] = await self._request(
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 268, in _request
    _raise_on_error(response)
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 286, in _raise_on_error
    raise_error(data["meta"]["msg"])
  File "/usr/local/lib/python3.10/site-packages/aiounifi/errors.py", line 61, in raise_error
    raise cls(error)
aiounifi.errors.AiounifiException: api.err.BlockUnifiDeviceForbidden
2022-10-19 11:28:33.707 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140430232107808] api.err.BlockUnifiDeviceForbidden
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 202, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 207, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/unifi/switch.py", line 355, in async_turn_off
    await self.controller.api.request(
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 211, in request
    response: list[dict[str, Any]] = await self._request(
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 268, in _request
    _raise_on_error(response)
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 286, in _raise_on_error
    raise_error(data["meta"]["msg"])
  File "/usr/local/lib/python3.10/site-packages/aiounifi/errors.py", line 61, in raise_error
    raise cls(error)
aiounifi.errors.AiounifiException: api.err.BlockUnifiDeviceForbidden

Additional information

Schermafbeelding 2022-10-19 om 11 33 53

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (19 by maintainers)

Most upvoted comments

cool!

so, if I disable POE control in the options, that will only take out my existing (named) switches, not the new POE switches?

Yes

I left the old implementation intact to not break current systems. The will be removed later on.

You can disable poe control in unifi options and the old implementation will disappear.

All new poe ports are disabled by default so you can decide which ones you want to use.

The state changes quicker now because it reacts on the port state rather than the client state now