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.65k stars 30.79k forks source link

Freebox component - Error during setup of component freebox #31486

Closed septeven closed 4 years ago

septeven commented 4 years ago

Home Assistant release with the issue: 0.103.6 Last working Home Assistant release (if known): I'm using the component for the first time so no relevant answer... Operating environment (Hass.io/Docker/Windows/etc.): Hassio supervisor 195, HassOS 3.5 Component/platform: https://www.home-assistant.io/components/freebox/

Description of problem: can't make it working, might be caused by the fact that my Freebox One is in bridge mode.

Error during setup of component freebox
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 958, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 945, in create_connection
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect
    return await fut
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 478, in _sock_connect
    sock.connect(address)
OSError: [Errno 101] Network unreachable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 172, in _async_setup_component
    hass, processed_config
  File "/usr/src/homeassistant/homeassistant/components/freebox/__init__.py", line 47, in async_setup
    await async_setup_freebox(hass, config, host, port)
  File "/usr/src/homeassistant/homeassistant/components/freebox/__init__.py", line 68, in async_setup_freebox
    await fbx.open(host, port)
  File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 66, in open
    self._access = await self._get_freebox_access(host, port, self.api_version, self.token_file, self.app_desc, self.timeout)
  File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 124, in _get_freebox_access
    app_token, track_id = await self._get_app_token(base_url, app_desc, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 181, in _get_app_token
    r = await self._session.post(url, data=data, timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
    timeout=real_timeout
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _create_direct_connection
    req=req, client_error=client_error)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host XXXXX.fbxos.fr:XXXXX ssl:None [Network unreachable]

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

freebox:
  host: XXXXX.fbxos.fr
  port: XXXXX

Additional information:

I strictly followed the documentation but I start asking myself if the fact that the freebox is in bridge mode could be the cause of the issue.

I need the component for using the freebox.reboot service particularly because the freebox looses internet connection time to time most likely because it is in bridge mode (known issue). The only way to get the connection back is to reboot the freebox.

If the fact I'm using it not as a router, would that be even possible to make only the freebox.reboot service accessible for non-router users ?

Thanks ;)

probot-home-assistant[bot] commented 4 years ago

Hey there @snoof85, mind taking a look at this issue as its been labeled with a integration (freebox) you are listed as a codeowner for? Thanks!

JuanitoAlimana commented 4 years ago

Start billing

El mié., 5 de feb. de 2020, 9:58 a. m., iOSC notifications@github.com escribió:

Home Assistant release with the issue: 0.103.6 Last working Home Assistant release (if known): I'm using the component for the first time so no relevant answer... Operating environment (Hass.io/Docker/Windows/etc.): Hassio supervisor 195, HassOS 3.5 Component/platform: https://www.home-assistant.io/components/freebox/

Description of problem: can't make it working, might be caused by the fact that my Freebox One is in bridge mode.

Error during setup of component freebox Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa File "/usr/local/lib/python3.7/asyncio/base_events.py", line 958, in create_connection raise exceptions[0] File "/usr/local/lib/python3.7/asyncio/base_events.py", line 945, in create_connection await self.sock_connect(sock, address) File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect return await fut File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 478, in _sock_connect sock.connect(address) OSError: [Errno 101] Network unreachable

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 172, in _async_setup_component hass, processed_config File "/usr/src/homeassistant/homeassistant/components/freebox/init.py", line 47, in async_setup await async_setup_freebox(hass, config, host, port) File "/usr/src/homeassistant/homeassistant/components/freebox/init.py", line 68, in async_setup_freebox await fbx.open(host, port) File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 66, in open self._access = await self._get_freebox_access(host, port, self.api_version, self.token_file, self.app_desc, self.timeout) File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 124, in _get_freebox_access app_token, track_id = await self._get_app_token(base_url, app_desc, timeout) File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 181, in _get_app_token r = await self._session.post(url, data=data, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request timeout=real_timeout File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection req, traces, timeout) File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _create_direct_connection req=req, client_error=client_error) File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host XXXXX.fbxos.fr:XXXXX ssl:None [Network unreachable]

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

freebox: host: XXXXX.fbxos.fr port: XXXXX

Additional information:

I strictly followed the documentation but I start asking myself if the fact that the freebox is in bridge mode could be the cause of the issue.

I need the component for using the freebox.reboot service particularly because the freebox looses internet connection time to time most likely because it is in bridge mode (known issue). The only way to get the connection back is to reboot the freebox.

If the fact I'm using it not as a router, would that be even possible to make only the freebox.reboot service accessible for non-router users ?

Thanks ;)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/31486?email_source=notifications&email_token=AKU5V2NEHQKTKYNRT3VOBQ3RBLHZRA5CNFSM4KQMQTLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILHOBAA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKU5V2IYWYDUQOTZFTSUSKDRBLHZRANCNFSM4KQMQTLA .

HobbitBen commented 4 years ago

Hey,

The integration had been working till update to HassOS 3.9 tonight. And now, I have the same issue.

Home Assistant release with the issue: 0.104.3 Operating environment: Hassio supervisor 198, HassOS 3.9

Error during setup of component freebox Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 170, in _async_setup_component hass, processed_config File "/usr/src/homeassistant/homeassistant/components/freebox/init.py", line 47, in async_setup await async_setup_freebox(hass, config, host, port) File "/usr/src/homeassistant/homeassistant/components/freebox/init.py", line 68, in async_setup_freebox await fbx.open(host, port) File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 66, in open self._access = await self._get_freebox_access(host, port, self.api_version, self.token_file, self.app_desc, self.timeout) File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 124, in _get_freebox_access app_token, track_id = await self._get_app_token(base_url, app_desc, timeout) File "/usr/local/lib/python3.7/site-packages/aiofreepybox/aiofreepybox.py", line 181, in _get_app_token r = await self._session.post(url, data=data, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 582, in _request break File "/usr/local/lib/python3.7/site-packages/aiohttp/helpers.py", line 586, in exit raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError

I tried to delete the freebox.conf in order to make the association again... The arrows on the freebox LCD screen never showed up.

SNoof85 commented 4 years ago

Hey,

I'm not using hassos but i'm up to date (HA Core 105.1 and Supervisor 199) and still working. And as you both do not have same version I'm pretty confident it's not from HassOS.

For ticket opener @septeven I've not tried with bridge mode but i guess this can work. But, there's something I have to tell you. The intergation here uses the api domain xxxx.fbxos.fr to pass commands / retrieve infos from the router. And this xxxx.fbxos.fr needs that your internet connection to be alive to work. This is not purely local. At the moment the underneath library aiofreepybox does not support pure local connection to the freebox. So your use case would not work i'm sorry. In a near future the aiofreepybox should evolve and support local connection too.

Back to both issues mentionned, would you mind having this correct on your freebox : https://www.home-assistant.io/integrations/freebox/#initial-setup

HobbitBen commented 4 years ago

Hey,

Thanks for the answer. However I don’t understand the point...

Everything is OK concerning the Freebox configuration. It’s reachable by remote connection (as the HA instance with an appropriate SSL certificate in fact). With my initial setup(0.104.3 and HassOS 3.8) everything was OK and functioning pretty well!

I Tried the 0.105 update tonight... The Freebox asks for the the authorisation (arrows) but there’s still the issue.

Think I will be Downgrading...

HobbitBen commented 4 years ago

Nope, I’ve been wrong. I just deleted all previous authorizations of HA in Freebox OS and redid the initial setup. It seems to be OK...

septeven commented 4 years ago

For ticket opener @septeven I've not tried with bridge mode but i guess this can work. But, there's something I have to tell you. The intergation here uses the api domain xxxx.fbxos.fr to pass commands / retrieve infos from the router. And this xxxx.fbxos.fr needs that your internet connection to be alive to work. This is not purely local. At the moment the underneath library aiofreepybox does not support pure local connection to the freebox. So your use case would not work i'm sorry. In a near future the aiofreepybox should evolve and support local connection too.

Back to both issues mentioned, would you mind having this correct on your freebox : https://www.home-assistant.io/integrations/freebox/#initial-setup

Thanks @SNoof85 - As per the initial setup requirements, as said, I already setup everything as required. Regarding a solution to reboot the freebox from a local call, I found this tutorial recently using this script. It seems to be usable directly from LAN, isn't it ? Maybe that could help you to find a way to implement something similar directly from your integration ?

As said, what I just need is to be able to ask HA to watch the internet status and if not reachable, to reboot the freebox....

SNoof85 commented 4 years ago

The concern here for local calls is not from HA, it's from the aiofreepybox python library used by HA to connect to the Freebox. This lib is currently under rework to make these local calls possible. But the owner of the lib has not so much time to review and merge PR that are done... We could wait a bit more for him, or if nothing happens we could also thinking about a fork and use this fork in HA. At the moment, be sure that you will not be able to monitor your internet connection with this integration, and you'll also be unable to reboot the Freebox with HA when internet is down. I'm sorry.

About the initial problem, could you try the Freebox compagnon app for iOS or Android to check if you can connect to your Freebox (this app is using basicaly same way to connect than HA). You could also check in the Freebox OS if you have some failed app registrations.

septeven commented 4 years ago

I see - I finally decided to code a custom component yesterday for reboot purpose only - it's actually my very first component but it works great. It's based on the Freebox API and I'm now able to check with HA if my internet connection is going down, and handle a reboot of the Freebox directly from HA / LAN.

As for the Freebox compagnon app, I used to have it installed and from what I can remember, it worked pretty well. I'm gonna try to test it again for you though - give me some days.

SNoof85 commented 4 years ago

Hey there, i know it's an old issue, but still open. Do you still need help with this ? Since the integration changed a lot from the time you opened this, have you tried it again ?

AntMCE commented 4 years ago

Hi there, Thanks for the response. I am still having issue, i tried again 2h ago. I thought it could be a certificate issue so i am now using my own subdomain (https) no luck.. I could however get the freebox to accept another application which was a torrent chrome extension.

septeven commented 4 years ago

Hey there, i know it's an old issue, but still open. Do you still need help with this ? Since the integration changed a lot from the time you opened this, have you tried it again ?

Personally, I developed my own Freebox component which works perfectly for what I need so I'm good - you can close the issue (unless others have the same problem).

SNoof85 commented 4 years ago

Hi there, Thanks for the response. I am still having issue, i tried again 2h ago. I thought it could be a certificate issue so i am now using my own subdomain (https) no luck.. I could however get the freebox to accept another application which was a torrent chrome extension. Sent from my Huawei

Could you please check if you have in /config/.storage folder a file named your_fbx_domain_fbxos_fr.conf ? Or in /config folder if you have a freebox.conf file.

If it's the case, 1st do a backup (full snapshot). Then remove any freebox configuration in yaml files of your configuration. Then remove the integration if setup with the UI. Then remove the files mentioned. Then reboot HA. If you are using latest versions of HA after reboot you can try to add the freebox via the front-end with the config flow (configuration -> integrations then + sign and select freebox).

AntMCE commented 4 years ago

Nothing at all in the in the .storageIn fact there is nothing at all relating to freebox, fbxos... I am unable to install from fronthand.

SNoof85 commented 4 years ago

Just a thought. What freebox model guys are you using ?

AntMCE commented 4 years ago

It is now working... For some reason the "submit button didn't show on my macbook pro. It did on my phone

SNoof85 commented 4 years ago

Nice ! So i guess we can close this issue as OP said he found a workaround and you finally managed to make it work.

AntMCE commented 4 years ago

Sure! Thx for the support

Quentame commented 4 years ago

Hey there, i know it's an old issue, but still open. Do you still need help with this ? Since the integration changed a lot from the time you opened this, have you tried it again ?

Personally, I developed my own Freebox component which works perfectly for what I need so I'm good - you can close the issue (unless others have the same problem).

Oh, cool ! Do you think you can contribute to improve the current official component ? Thanks.