koush / ha_scrypted

35 stars 5 forks source link

Home assistant integration fails in HA 2024.10.b0 #21

Closed wormiedk closed 1 month ago

wormiedk commented 2 months ago

I get the following error

Logger: homeassistant.setup
Source: setup.py:416
First occurred: 14:12:31 (1 occurrences)
Last logged: 14:12:31

Error during setup of component scrypted
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 416, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/scrypted/__init__.py", line 28, in async_setup
    hass.http.register_view(ScryptedView(hass, session))
  File "/usr/src/homeassistant/homeassistant/components/http/__init__.py", line 432, in register_view
    view.register(self.hass, self.app, self.app.router)
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 188, in register
    allow_cors(route)
  File "/usr/src/homeassistant/homeassistant/components/http/cors.py", line 72, in _allow_cors
    cors.add(route, config)
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/cors_config.py", line 263, in add
    return self._cors_impl.add(routing_entity, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/cors_config.py", line 134, in add
    self._router_adapter.add_preflight_handler(
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/urldispatcher_router_adapter.py", line 195, in add_preflight_handler
    self.add_preflight_handler(route.resource, handler)
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/urldispatcher_router_adapter.py", line 161, in add_preflight_handler
    raise ValueError(
ValueError: <DynamicResource  /api/scrypted/{token}/{path}> already has OPTIONS handler <function request_handler_factory.<locals>.handle at 0x7f12dc097a60>
rononline commented 2 months ago

Same for me on 2024.10.b1

tomlut commented 2 months ago

Instead of "me too" posts just thumb up the original issue. 👍

townsmcp commented 1 month ago

Just want to add to this, I am also getting the same issue (on 2024.10.0b4) however having Scrypted installed as an addon to HA is working fine - its just the integration from HACS that is failing, core Scrypted is working ok on HA. Lol I was about to start setting up a new version of Scrypted outside of HA (to start playing with NVR with more resources in a Proxmox LXC than I have dedicated for my HA VM) and then use this integration to link everything together in HA but I think I will wait for now

u20p17 commented 1 month ago

same issue for me with HA2024.10 update from yesterday:

Logger: homeassistant.setup
Quelle: setup.py:416
Erstmals aufgetreten: 09:44:33 (1 Vorkommnisse)
Zuletzt protokolliert: 09:44:33

Error during setup of component scrypted
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 416, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/scrypted/__init__.py", line 28, in async_setup
    hass.http.register_view(ScryptedView(hass, session))
  File "/usr/src/homeassistant/homeassistant/components/http/__init__.py", line 432, in register_view
    view.register(self.hass, self.app, self.app.router)
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 188, in register
    allow_cors(route)
  File "/usr/src/homeassistant/homeassistant/components/http/cors.py", line 72, in _allow_cors
    cors.add(route, config)
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/cors_config.py", line 263, in add
    return self._cors_impl.add(routing_entity, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/cors_config.py", line 134, in add
    self._router_adapter.add_preflight_handler(
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/urldispatcher_router_adapter.py", line 195, in add_preflight_handler
    self.add_preflight_handler(route.resource, handler)
  File "/usr/local/lib/python3.12/site-packages/aiohttp_cors/urldispatcher_router_adapter.py", line 161, in add_preflight_handler
    raise ValueError(
ValueError: <DynamicResource  /api/scrypted/{token}/{path}> already has OPTIONS handler <function request_handler_factory.<locals>.handle at 0x7f45cd25ce00>
haxzamatic commented 1 month ago

I just opened HACS, clicked the 3 dots in the Scrypted section and selected redownload. This fixed my issue.

wormiedk commented 1 month ago

Just tried it but did not fix for me unfortunately

Mokolag commented 1 month ago

I just opened HACS, clicked the 3 dots in the Scrypted section and selected redownload. This fixed my issue.

Same issue with HA 2024.10 and your solution works fine, thanks !