home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.88k stars 30.95k forks source link

AVM FRITZ!Box Tools: Connection Error #129853

Open slartibartfass opened 2 weeks ago

slartibartfass commented 2 weeks ago

The problem

Fritzbox 7590 Firmware 8.0 wont integrate to HA

What version of Home Assistant Core has the issue?

core-2024.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

Fritz!Box Tools

Link to integration documentation on our website

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

Diagnostics information

home-assistant_fritz_2024-11-04T21-22-43.233Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Quelle: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:448
Erstmals aufgetreten: 22:11:46 (2 Vorkommnisse)
Zuletzt protokolliert: 22:11:58

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 370, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 417, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 520, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/fritz/config_flow.py", line 201, in async_step_confirm
    error = await self.hass.async_add_executor_job(self.fritz_tools_init)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/fritz/config_flow.py", line 103, in fritz_tools_init
    and not connection.call_action("X_AVM-DE_UPnP1", "GetInfo")["NewEnable"]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/fritzconnection.py", line 456, in call_action
    return self.soaper.execute(service, action_name, arguments)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/soaper.py", line 286, in execute
    return handle_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/soaper.py", line 268, in handle_response
    raise_fritzconnection_error(response)
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/soaper.py", line 191, in raise_fritzconnection_error
    raise exception(message)
fritzconnection.core.exceptions.FritzInternalError: UPnPError: 
errorCode: 820
errorDescription: Internal Error

Additional information

No response

home-assistant[bot] commented 2 weeks ago

Hey there @aarondavidschneider, @chemelli74, @mib1185, mind taking a look at this issue as it has been labeled with an integration (fritz) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `fritz` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign fritz` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


fritz documentation fritz source (message by IssueLinks)

mib1185 commented 2 weeks ago

did it work before you updated to FritzOS 8?

This upnp internal error 820 is mostly related to issues within the Fritzbox itself - see similar previous issue reports: https://github.com/home-assistant/core/issues?q=label%3A%22integration%3A+fritz%22+upnp+820+is%3Aclosed

slartibartfass commented 2 weeks ago

did it work before you updated to FritzOS 8?

Yes it worked with FritzOS 7.x - but then it suddenly stopped working without changes/updates to FritzOS. So this could be related to a HA-Update.

TR-064 and UPNP are activated and Username/Password are correct.

I restartet both: Homeassisant & Fritzbox - but no change.

My Fritz Repeater 2400 can connect without errors

mib1185 commented 2 weeks ago

Yes it worked with FritzOS 7.x - but then it suddenly stopped working without changes/updates to FritzOS.

so it also worked already with FritzOS 8?

slartibartfass commented 2 weeks ago

so it also worked already with FritzOS 8?

No, it does not worked ever with final 8.0 but with the latest AVM Labor Firmware for 8.0

mib1185 commented 2 weeks ago

so as soon as you updated the fritzbox from Lab-Version 8 to final version 8 it stopped working?

Swimmer71 commented 1 week ago

Same issue here: update my 7590 to Firmware 8, then changed box to 7690 with latest beta 7.9. Can not integrate the box, although user and password were set correct Screenshot_2024-11-09-20-11-42-14_c3a231c25ed346e59462e84656a70e50

Swimmer71 commented 1 week ago

What I wanted to say: Integration does not work with Firmware 8, and even not with beta 7.9

Swimmer71 commented 1 week ago

Everything is working again after beta 7.9 117019 from today

mib1185 commented 1 week ago

@Swimmer71 you issue seems to be different (you've an upnp 401 error, but this issue report is about a upnp 820 error) please open a new issue report, but in as much details as possible, also please consider the troubleshooting section of the integrations documentation, thx :+1: i've hide your comments, to keep the overview in this thread

slartibartfass commented 12 hours ago

I reflashed the v.8 Firmware for the Fritzbox, i restartet Homeassistant and try to reintegrate Fritzbox 7590.

Still the same Error:

<name>X_AVM-DE_WPSEnable</name>
2024-11-22 14:30:26.617 DEBUG (SyncWorker_9) [fritzconnection] 
http://192.168.10.1:49000/upnp/control/x_upnp
2024-11-22 14:30:26.617 DEBUG (SyncWorker_9) [fritzconnection] b'<?xml version="1.0" encoding="utf-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:GetInfo xmlns:u="urn:dslforum-org:service:X_AVM-DE_UPnP:1"></u:GetInfo></s:Body></s:Envelope>'
2024-11-22 14:30:26.682 DEBUG (SyncWorker_9) [fritzconnection] response status: 500
2024-11-22 14:30:26.682 DEBUG (SyncWorker_9) [fritzconnection] <?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:dslforum-org:control-1-0">
<errorCode>820</errorCode>
<errorDescription>Internal Error</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
2024-11-22 14:30:26.686 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 567, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/fritz/config_flow.py", line 206, in async_step_confirm
    error = await self.async_fritz_tools_init()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/fritz/config_flow.py", line 79, in async_fritz_tools_init
    return await self.hass.async_add_executor_job(self.fritz_tools_init)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/fritz/config_flow.py", line 106, in fritz_tools_init
    and not connection.call_action("X_AVM-DE_UPnP1", "GetInfo")["NewEnable"]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/fritzconnection.py", line 456, in call_action
    return self.soaper.execute(service, action_name, arguments)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/soaper.py", line 286, in execute
    return handle_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/soaper.py", line 268, in handle_response
    raise_fritzconnection_error(response)
  File "/usr/local/lib/python3.12/site-packages/fritzconnection/core/soaper.py", line 191, in raise_fritzconnection_error
    raise exception(message)
fritzconnection.core.exceptions.FritzInternalError: UPnPError: 
errorCode: 820
errorDescription: Internal Error

home-assistant_fritz_2024-11-22T13-30-31.573Z.log

Swimmer71 commented 10 hours ago

My 7590 with V8 also had the problem, but strange that my new 7690 with Beta 7.90-117019 works, I mean I could integrate it.

(But my posts are obviously off-topic although I had the same connection error. Only the UPNP error is different but I am sure it is due to the same Fritz problem ;-))

mib1185 commented 10 hours ago

@Swimmer71 please check your log files - especial the last 3 lines of the full error message starting with fritzconnection.core.exceptions.FritzInternalError: UPnPError: - they should be different, since in the screenshot we already see the errorcode is 401 and not 820

mib1185 commented 9 hours ago

@slartibartfass Please provide screenshots of "Home Network > Network > Access Settings in the Home Network" and "Home Network > Media Server > Settings"

Further could you please run this small python script (replace xxx with correct username and pasword) and past just the output of it? You need to install the fritzconnection library first.

from logging import StreamHandler
from fritzconnection import FritzConnection
from fritzconnection.core.logger import activate_local_debug_mode

BOX_IP = "fritz.box"
BOX_USER = "xxxx"
BOX_PASS = "xxxx"

# login
fc = FritzConnection(address=BOX_IP, user=BOX_USER, password=BOX_PASS)
# enable debug logging
activate_local_debug_mode(handler=StreamHandler())
# do api call
fc.call_action("X_AVM-DE_UPnP1", "GetInfo")
Swimmer71 commented 8 hours ago

@Swimmer71 please check your log files - especial the last 3 lines of the full error message starting with fritzconnection.core.exceptions.FritzInternalError: UPnPError: - they should be different, since in the screenshot we already see the errorcode is 401 and not 820

Right now, the integration works for my 7690 with 7.90-117019. So I can not provide error logs. The errors were with firmware before, I think 7.6xxxx. Lets see, when AVM release 8.0 for 7690....

slartibartfass commented 8 hours ago

I installed the fritzconnection library but could not get the script to run without errors. I saved the skript as "fritz.py" and let it run.

Error is Exception in </config/pyscript/fritz.py> line 1: from logging import StreamHandler ^ ModuleNotFoundError: import from logging not allowed

Screenshots are provided: kAiXm44hNc VSOm8rKec3

slartibartfass commented 8 hours ago

@mib1185

I installed fritzconnection library local on my pc and let it run with correct ip, user and pwd. perhaps the result will help you.

C:\Users\tester\Downloads>fritz.py
DEBUG:fritzconnection:
http://192.168.10.1:49000/upnp/control/x_upnp
DEBUG:fritzconnection:b'<?xml version="1.0" encoding="utf-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:GetInfo xmlns:u="urn:dslforum-org:service:X_AVM-DE_UPnP:1"></u:GetInfo></s:Body></s:Envelope>'
DEBUG:fritzconnection:response status: 500
DEBUG:fritzconnection:<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:dslforum-org:control-1-0">
<errorCode>820</errorCode>
<errorDescription>Internal Error</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Traceback (most recent call last):
  File "C:\Users\tester\Downloads\fritz.py", line 14, in <module>
    fc.call_action("X_AVM-DE_UPnP1", "GetInfo")
  File "C:\Users\tester\AppData\Roaming\Python\Python312\site-packages\fritzconnection\core\fritzconnection.py", line 456, in call_action
    return self.soaper.execute(service, action_name, arguments)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tester\AppData\Roaming\Python\Python312\site-packages\fritzconnection\core\soaper.py", line 286, in execute
    return handle_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tester\AppData\Roaming\Python\Python312\site-packages\fritzconnection\core\soaper.py", line 268, in handle_response
    raise_fritzconnection_error(response)
  File "C:\Users\tester\AppData\Roaming\Python\Python312\site-packages\fritzconnection\core\soaper.py", line 191, in raise_fritzconnection_error
    raise exception(message)
fritzconnection.core.exceptions.FritzInternalError: UPnPError:
errorCode: 820
errorDescription: Internal Error
mib1185 commented 3 hours ago

@slartibartfass just for the science - could you please disable the media server on the Fritzbox and than re-try to run the script?