Fritzbox connection issue (port 80)

Hi!

I’m trying to connect my fritzbox to my hassbian setup. Thus, I have added

fritzbox:
  devices:
    - host: my_IP
      username: my_username
      password: my_password

to my configuration.yaml. I have added a new user to fritzbox and added permissions to the user to address the smart home devices connected to my fritzbox. I have tested the login with the new user on the webinterface of the fritzbox and it works. However, when I am restarting the HA, it complains that there is no route to the fritzbox host. Taking a look at the logs of HA reveals that HA wants to connect to the fritzbox via port 80 (where nothing is running) and not 443 as it should be. Here are some snippets of the logs

2019-09-23 09:18:19 ERROR (MainThread) [homeassistant.setup] Error during setup of component fritzbox
Traceback (most recent call last):
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
   (self._dns_host, self.port), self.timeout, **extra_kw
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
   raise err
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
   sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
   chunked=chunked,
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
   conn.request(method, url, **httplib_request_kw)
 File "/usr/lib/python3.7/http/client.py", line 1229, in request
   self._send_request(method, url, body, headers, encode_chunked)
 File "/usr/lib/python3.7/http/client.py", line 1275, in _send_request
   self.endheaders(body, encode_chunked=encode_chunked)
 File "/usr/lib/python3.7/http/client.py", line 1224, in endheaders
   self._send_output(message_body, encode_chunked=encode_chunked)
 File "/usr/lib/python3.7/http/client.py", line 1016, in _send_output
   self.send(msg)
 File "/usr/lib/python3.7/http/client.py", line 956, in send
   self.connect()
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
   conn = self._new_conn()
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
   self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x68c04ed0>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/srv/homeassistant/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
   timeout=timeout
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
   method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
 File "/srv/homeassistant/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
   raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.0.3', port=80): Max retries exceeded with url: /login_sid.lua (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x68c04ed0>: Failed to establish a new connection: [Errno 113] No route to host'))

Any ideas?

Thanks in advance and kind regards,
Roman.

I have the same setup here, just in Hass.io and that works correctly (though giving some weird readings in up/down speeds).
I have just entered the IP (not a port) in the host field.
It’s a bit worrying if it connects via port 80 with my username/password :roll_eyes: but I haven’t done a trace of it.
I’m not at home, so I can’t look up what attributes the user I’ve defined has (I have not allowed public access to the router because of lack of 2FA), previously it wasn’t possible to create a user with only smart-home access that would work (I reported that to AVM), but that might have changed.

btw. mine is a 7560 with 7.x in firmware (if that matters)

1 Like

Dear fribse,

thank for your fast response and the info! It would be nice if you can check and tell me your settings when you’re at home. I have been playing around with my 7390 Fritzbox (Fritz!OS 06.85) for quite a while now and it doesn’t work. To be honest, I am absolutely clueless right now because I have checked everything not only twice but even 10 times. Everything in the configs look fine. Btw, I have also tried it on Hass.io and ran into the same problem. If HA really tries to connect to port 80 for some reason, then the no route to host message seems reasonable. However, in this case I don’t understand the connection attempt to port 80 when 443 as default in Fritz!OS.

One additional question: Do you connect from a LAN port or from a WAN port?

Thanks in advance and kind regards,
Roman.

1 Like

I’ve set it to connect to LAN side (as I don’t have any public access).
It’s set up as a router for a fiber connection, so port1 is WAN, and 2+3+4 is LAN.
I’ll have a look at it later!

1 Like

The user I have defined has the top three access types enabled.
Fritz!Box settings
Voice messages
Smart Home

1 Like

Dear fribse,

sorry for my delayed response but yesterday it was too late and I was to tired to check the forum.

I have enabled the same access types as you have.

I will check it with a connection to one of the LAN ports. Maybe that’s the root of the problem. I don’t use the Fritzbox as router because it sucks as router IMHO :wink: . I just use it as DECT telephone switch and for my 8 FRITZ!DECT 200 switches. The later I would like to control by means of HA which is the reason why I am trying to connect the Fritzbox to HA.

Kind regards,
Roman.

1 Like

I’m very much contemplating switching away from it as a switch as well. I’m using it as a PBX and for the fritz!dect thermostats :slight_smile:

Hello,

i would like to give a short update if someone else runs into the same problem:

Today, I have found some spare time to play around and finally found the root of the problem. The fritzbox component integrated into HA doesn’t seem to support connections from the WAN port regardless of the permissions set in the fritzbox webinterface. I don’t know the reason for this behavior but that’s a fact. On the other hand, everything works fine if you issue a connection from the LAN part of the fritzbox.

Kind regards,
Roman.

I got the same issue.
My Config:

  • Raspberry pi 4b (Connected on Port 5 of fritz.box)
  • FRITZ!Box 7590
  • Docker
  • Portainer
  • HASS_IO as Docker Container

On my Fritzbox I created custom users for connecting the admin interface.
I named it HAFritz-User
After integrating the Fritzbox Connecto using HAFritz-User, everything worked fine. After a couple of hours lovelace lost connection to my thermostats (running as Smart Home Devices on Fritz.box)

I changed the ethernet cable to Port 4 on Fritz.box. same issue
Also my raspi crashed completely when I restarted the HASS_IO docker container.

After changing the connection user between Home Assistent and fritz.box from HAFritz-User to admin, everything works fine.

So there must be an issue by not using ADMIN as connection between HASS_IO and fritz.box.