Closed HHoppenstock closed 1 year ago
Hey there @mib1185, @flabbamann, mind taking a look at this issue as it has been labeled with an integration (fritzbox
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
fritzbox documentation fritzbox source (message by IssueLinks)
Hi @HHoppenstock
please enable debug logging, restart HA and provide the home-assistant.log.
To do so add the following to your configuration.yaml
:
logger:
default: info
logs:
homeassistant.components.fritzbox: debug
pyfritzhome: debug
Further please also check the logs if the Fritzbox itself, if there are authentication (or any other) issues logged.
Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.
home-assistant_2022-12-14T19-24-18.071Z.log
I added the lines to my configuration.yaml and added the log. After changing the configuration.yaml and a restart of the docker container I tried to add the Smarthome integration.
No logs in my FritzBox
the log file seems to be truncated, there is nothing in it about your try to add the AVM!SmartHome integration 🤔
Just want to add that I am also not able to log in via the SmartHome Integration. The Tools Integration is working fine.
@whiletruefranz please provide debug logs as described in https://github.com/home-assistant/core/issues/83987#issuecomment-1351679013
@mib1185 Only pyfritzhome log is:
2022-12-19 13:30:04.685 WARNING (SyncWorker_9) [pyfritzhome.fritzhome] login failed 0000000000000000
I'm using the exact same credentials that work for the Fritz Box Tools Integration. Permissions to access Smart Home are set in fritzOS. EDIT: Event-Logs within fritzOS suggest a wrong password. I even changed it and copy-pasted it from a notepad. There is no way that the password is wrong.
Maybe a problem with some special character in the password?
@flabbamann I don't think so as it is alphanumeric.
which model and firmware is it? do have any kind of multi-factor-auth enabled?
@mib1185 Fritz!Box 7590 AX, 07.31 and no multi-factor-auth
please share the full message from FritzBox log (it's ok when in German) which occur during trying to setup the Fritz!Smarthome integration
@mib1185 I just tried again to get the error message and it worked first try. Same credentials as yesterday (still copy pasted from the notepad).
I don't actually know where to ask so I'll do it here: Is it possible to customize the implementation of the Fritz Dect 200/210 so that the consumption can be tracked as generation? I have the 210 attached to a micro inverter with a small PV setup on my garage and I'd like to use the data it provides correctly.
I would suggest to place this question on our forum, since we use GitHub for tracking issues with Home Assistant Core itself, not for providing support.
Hi, I think I found something.
Today in my HA dev environment the FRITZ!SmartHome integration could not log in to the FritzBox, while at the same time my productive HA instance can access and control my FB. As above no errors in HA or FB logs 🤨.
On login errors the original exception is lost. I opened a PR to change that in the library: https://github.com/hthiery/python-fritzhome/pull/73
With this change I found that HA gets an error 503 from the Fritzbox:
2022-12-21 00:09:36.345 ERROR (SyncWorker_0) [pyfritzhome.fritzhome] 503 Server Error: Service Unavailable for url: http://fritz.box/login_sid.lua
I don't really understand what's happening here. I have no problems logging in on the FB via browser or my productive HA instance. A bug in the Fritzbox? Hardware Limits? Solar storm? 🤔
I have a FB 7590 running latest FritzOS 7.50
I tried to add the FritzSmartHome integration with an older Docker Desktop version 4.12 with the latest stable homeassistant 12.7 and it worked without any issues. Using the latest Docker Desktop version 4.15 I run in the authentification error.
@flabbamann were there any entries in the Fritz!Box log itself at the time of the issue?
@mib1185 unfortunately not ☹️
maybe some new security feature in FritzOS 7.50 (somethin like "login count limit per source ip") 🤔 unfortunately, my 7530ax does not get the 7.50 yet, so i cannot test/check anything by my own 😕
I just switched from a 7490 (where the Smarthome did work, but not stable - I had authentication and timeout problems all through the day) to a 7530AX (7.31) and login is not possible. I will try to activate debug logging.
But the problem must be the Smarthome Integration exclusively, as the "Tools" integration did work flawlessly with the 7530AX.
Update: 1 days later I switched on debugging and... suddenly everything works (7530 AX)! Login was successfull immediately and it didn't lose authentiation since then (1 week ago). Strange. Maybe the fritzbox needs some more time after bootup to run all processes?
Since the newest version of HomeAssistant I always get the error message "Invalid authentication" when I try to set up the "AVM FRITZ!SmartHome" integration. The other two FritzBox integrations "FRITZ!Box Tools" and "AVM FRITZ!Box Call Monitor" are working without any issue and can be setup with the same credentials "AVM FRITZ!SmartHome" won't accept.
same issue here since ha: 2023.2.0 (OVA Synology VM) FB: 7590 FBOS: 7.50
It seems to be an issue with docker desktop for windows. I installed the latest version of HA on a raspberry and the Smarthome Integration works fine.
It seems to be an issue with docker desktop for windows. I installed the latest version of HA on a raspberry and the Smarthome Integration works fine.
Interesting. That matches my observations. I had problems in my dev environment (docker desktop on windows), while at the same time my productive instance (docker on Linux) was working fine.
same issue here since ha: 2023.2.0 (OVA Synology VM) FB: 7590 FBOS: 7.50
It now seems to work again, for a few days no more crashes in the connection to the FritzBox, the authentication is possible again without problems and is stable again. I can't understand why it's working again now. The logs of the Fritzbox are not helpful there either.
I apologize for the unhelpful messages from me.
You are not alone @maddinhome. I can report the same. It's stable for weeks now. I once got prompted for re-signing the integration again but that's all. I am still on 7.31. Very strange.
Same issued with newest HA and FB 7530 (FW 7.29, no newer available)
No Error Message in FB, HA same as above login failed 0000000000000000
Yesterday I installed a new HA with HA OS and could connect in the beginning, but a few minutes later, same Error again. FB Router and Phonebook working correctly... Checked User and PW several times, tried different FB Users: Always the same error. Reboot FB and HA without effect.
Any suggestions what to do ?
For those who still have issues, please provide debug logs as described in https://github.com/home-assistant/core/issues/83987#issuecomment-1351679013
Seems to be a miracle when writing a comment here ... Updated my Fritzbox 7530 to 7.50, updated HA to Home Assistant 2023.3.0 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230301.0 - latest
activated debug logs as described above restarted everything and wanted to upload the log, but
-> everything works now :-)
For those who still have issues, please provide debug logs as described in #83987 (comment)
Unfortunately there is not much that is logged. Even with fritzbox component and pyfritzhome in debug, only the following is logged:
2023-03-06 04:17:41.309 INFO (SyncWorker_3) [pyfritzhome.fritzhome] Updating Devices ...
2023-03-06 04:17:42.920 WARNING (SyncWorker_3) [pyfritzhome.fritzhome] login failed 0000000000000000
2023-03-06 04:17:42.940 ERROR (MainThread) [homeassistant.components.fritzbox] Authentication failed while fetching b71d5c3adcfec1233b9723b04e770dd6 data: login for user="homeassistant-smarthome" failed
I'm on Home Assistant 2023.2.5 but this happened for multiple/all older versions I was running as well sporadically.
This happens to me from time to time (with the FRITZ!SmartHome component only, FRITZ!Box Call Monitor and AVM FRITZ!Box Tools don't seem to suffer from this. But AIUI they don't use the HTTP API, so it's a completely different thing there really). When this happens I'm asked to reconfigure the integration and I can do so with the same password as before so I would assume this is a temporary issue.
Correlating logs from the fritzbox itself (in German only. Unfortunately the fritzbox does reboot and flush logs when changing the language):
06.03.23 04:17:43 Anmeldung einer App des Benutzers homeassistant von IP-Adresse 192.168.2.240.
06.03.23 04:17:42 Anmeldung an der FRITZ!Box-Benutzeroberfläche von IP-Adresse 192.168.2.240 gescheitert (ungültige Sitzungskennung). Zur Sicherheit werden alle noch gültigen Sitzungen zur IP-Adresse 192.168.2.240 beendet.
06.03.23 04:17:42 Anmeldung des Benutzers homeassistant-smarthome an der FRITZ!Box-Benutzeroberfläche von IP-Adresse .
06.03.23 04:17:12 Anmeldung einer App des Benutzers homeassistant von IP-Adresse 192.168.2.240.
06.03.23 04:17:12 Anmeldung an der FRITZ!Box-Benutzeroberfläche von IP-Adresse 192.168.2.240 gescheitert (ungültige Sitzungskennung). Zur Sicherheit werden alle noch gültigen Sitzungen zur IP-Adresse 192.168.2.240 beendet.
06.03.23 04:17:12 Anmeldung des Benutzers smarthome an der FRITZ!Box-Benutzeroberfläche von IP-Adresse .
The user smarthome
is used by a different tool gathering metrics and for me this looks a bit like a race condition between these two. The login code of both (fritzhome and fritzconnection) for the HTTP API suggest that it's not unusual that the login fails (with valid credentials) returning the session ID 0000000000000000:
https://github.com/hthiery/python-fritzhome/blob/faf67f486db582b5d6ebcc502b92a0096857d75f/pyfritzhome/fritzhome.py#L93 https://github.com/kbr/fritzconnection/blob/183b1044219a9ec69cf01e1bc6e8aac9fabf1b75/fritzconnection/core/fritzhttp.py#L99
Also fritzhome uses the deprecated md5 challenge with HTTP GET instead of pbkdf2 and HTTP POST (as does the other metrics scraper connecting as user smarthome
in my case). Maybe that's the reason why the fritzbox invalidated all sessions from the host.
The lazy way out is probably to retry the call (with exponential backoff) - if that would be possible.
they don't use the HTTP API
that's correct - FritzSmarthome uses the http, but FritzTools and FritzCallmonitor the tr064 api (see here for details)
Correlating logs from the fritzbox itself (in German only. Unfortunately the fritzbox does reboot and flush logs when changing the language):
06.03.23 04:17:43 Anmeldung einer App des Benutzers homeassistant von IP-Adresse 192.168.2.240. 06.03.23 04:17:42 Anmeldung an der FRITZ!Box-Benutzeroberfläche von IP-Adresse 192.168.2.240 gescheitert (ungültige Sitzungskennung). Zur Sicherheit werden alle noch gültigen Sitzungen zur IP-Adresse 192.168.2.240 beendet. 06.03.23 04:17:42 Anmeldung des Benutzers homeassistant-smarthome an der FRITZ!Box-Benutzeroberfläche von IP-Adresse . 06.03.23 04:17:12 Anmeldung einer App des Benutzers homeassistant von IP-Adresse 192.168.2.240. 06.03.23 04:17:12 Anmeldung an der FRITZ!Box-Benutzeroberfläche von IP-Adresse 192.168.2.240 gescheitert (ungültige Sitzungskennung). Zur Sicherheit werden alle noch gültigen Sitzungen zur IP-Adresse 192.168.2.240 beendet. 06.03.23 04:17:12 Anmeldung des Benutzers smarthome an der FRITZ!Box-Benutzeroberfläche von IP-Adresse .
there are three different users used from same? IP ... i think the fritzbox does not like that 🤔 try to use same user for FritzTools, FritzSmarthome and FritzCallmanager integration
Also fritzhome uses the deprecated md5 challenge with HTTP GET instead of pbkdf2 and HTTP POST (as does the other metrics scraper connecting as user
smarthome
in my case). Maybe that's the reason why the fritzbox invalidated all sessions from the host.
this should be reported to the python-fritzhome repository.
there are three different users used from same? IP ... i think the fritzbox does not like that thinking try to use same user for FritzTools, FritzSmarthome and FritzCallmanager integration The same happens with only one user for everything. I've only split them up to have a better understanding of which one triggers the actual issue. My understanding is that if one of the logins fail for whatever reason (the race condition part) the FritzBox invalidates all sessions from the source IP of the failed login.
Also fritzhome uses the deprecated md5 challenge with HTTP GET instead of pbkdf2 and HTTP POST (as does the other metrics scraper connecting as user
smarthome
in my case). Maybe that's the reason why the fritzbox invalidated all sessions from the host.this should be reported to the python-fritzhome repository.
Will do. Do you happen do have an understanding on why python-fritzhome
is used for that part whereas the other FritzBox integrations use fritzconnection
(which has pkbdf2 login implemented)? It's probably for historical reasons but it seems a bit counter intuitive to depend on two different libraries here.
The Fritz!Smarthome and Fritz!Tools integrations were developed independently, further the rely on different APIs of the FritzBox.
The python-fritzhome
lib was the first which implements the http api (because it is the intention of this lib), but the fritzconnection
got the http api only now in the last few weeks/months, so it is quite new and maybe not fully functional, yet.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
The problem
Since the newest version of HomeAssistant I always get the error message "Invalid authentication" when I try to set up the "AVM FRITZ!SmartHome" integration. The other two FritzBox integrations "FRITZ!Box Tools" and "AVM FRITZ!Box Call Monitor" are working without any issue and can be setup with the same credentials "AVM FRITZ!SmartHome" won't accept. My FB is a 7490 with OS version 7.29.
What version of Home Assistant Core has the issue?
Home Assistant 2022.12.5
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!SmartHome
Link to integration documentation on our website
https://www.home-assistant.io/integrations/fritzbox
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response