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.61k stars 30.77k forks source link

Freebox Revolution has no RAID #97652

Closed Gonioul closed 1 year ago

Gonioul commented 1 year ago

The problem

Freebox integration doesn't work anymore for my Freebox Revolution in 2023.08, looks for a RAID that doesn't exists.

What version of Home Assistant Core has the issue?

core-2023.8.0

What was the last working version of Home Assistant Core?

core-2023.7.3

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Freebox

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/freebox/__init__.py", line 60, in async_setup_entry
    await router.update_all()
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 86, in update_all
    await self.update_sensors()
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 149, in update_sensors
    await self._update_raids_sensors()
  File "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 164, in _update_raids_sensors
    fbx_raids: list[dict[str, Any]] = await self._api.storage.get_raids() or []
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/freebox_api/api/storage.py", line 85, in get_raids
    return await self._access.get("storage/raid/")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/freebox_api/access.py", line 122, in get
    return await self._perform_request(self.session.get, end_url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/freebox_api/access.py", line 114, in _perform_request
    raise HttpRequestError(err_msg)
freebox_api.exceptions.HttpRequestError: Request failed (APIResponse: {"msg": "Erreur interne", "success": false, "error_code": "internal_error"}

Additional information

No response

Gonioul commented 1 year ago

Looks like this is the problem: https://github.com/home-assistant/core/pull/95242

Skuair commented 1 year ago

Same problem for me after updated to 2023.8.0 yesterday (same log).

@Gonioul you have to tag this issue with the label "integration: freebox" in order to alert integration owner automatically.

home-assistant[bot] commented 1 year ago

Hey there @hacf-fr, @quentame, mind taking a look at this issue as it has been labeled with an integration (freebox) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `freebox` 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 freebox` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


freebox documentation freebox source (message by IssueLinks)

Pierrodu21 commented 1 year ago

Same issue here after updating to 2023.8.0!

Can we give you more details to help with this issue?

Configuration failure Log Unavailable

Pendragon commented 1 year ago

That's a painful issue. All services linked to the box are dead. Presence especially.

I would like to suggest a quickfix

In the file "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 164, in _update_raids_sensors fbx_raids: list[dict[str, Any]] = await self._api.storage.get_raids() or []

Changed the code in fbx_raids: list[dict[str, Any]] = []

I don't find /usr/src with ssh addon or vscode. Most probably due to docker containment. I consider rolling back to 2023.7.3

Write commented 1 year ago

That's a painful issue. All services linked to the box are dead. Presence especially.

I would like to suggest a quickfix

In the file "/usr/src/homeassistant/homeassistant/components/freebox/router.py", line 164, in _update_raids_sensors fbx_raids: list[dict[str, Any]] = await self._api.storage.get_raids() or []

Changed the code in fbx_raids: list[dict[str, Any]] = []

I don't find /usr/src with ssh addon or vscode. Most probably due to docker containment. I consider rolling back to 2023.7.3

I tried your fix but it still throw an error, if you want to try :

Based on your answer to apply quickly the fix :

# enter the container
docker exec -it homeassistant /bin/bash 

# preview the change
sed 's|fbx_raids: list\[dict\[str, Any\]\] = await self._api.storage.get_raids() or \[\]|fbx_raids: list[dict[str, Any]] = []|g' /usr/src/homeassistant/homeassistant/components/freebox/router.py | diff /usr/src/homeassistant/homeassistant/components/freebox/router.py -

# apply the change
sed -i 's|fbx_raids: list\[dict\[str, Any\]\] = await self._api.storage.get_raids() or \[\]|fbx_raids: list[dict[str, Any]] = []|g' /usr/src/homeassistant/homeassistant/components/freebox/router.py

# reload freebox integration
cyr-ius commented 1 year ago

I just submitted a fix via a PR hoping that it will be taken quickly in the next version.

Raid APIs are marked as UNSTABLE at Free so not sure it works everywhere. In any case it does not work on my freebox POP

image

cyr-ius commented 1 year ago

For those who want to take advantage of the 2023.8.0 version, just copy the freebox component folder as custom_component with the issue code fixed

https://github.com/cyr-ius/home-assistant/tree/Freebox---Enum-raid-disks/homeassistant/components/freebox

Because it is the holidays. The correction may not be merged immediately

Pierrodu21 commented 1 year ago

Thanks @cyr-ius !

Pendragon commented 1 year ago

Thanks @Write was able to fix it the dirty way on my installation thanks to your comment image

Thanks @cyr-ius for the real correction

Skuair commented 1 year ago

Thanks @Write was able to fix it the dirty way on my installation thanks to your comment image

Thanks @cyr-ius for the real correction

How do you proceed to edit the source file in a Hassio installation? I suppose we cannot access the containers ?

Otherwise, method from @cyr-ius, by adding the integration as custom_component will overload the official one ? Or do I have somethyelse to do in HA ?

Write commented 1 year ago

Thanks @Write was able to fix it the dirty way on my installation thanks to your comment image Thanks @cyr-ius for the real correction

How do you proceed to edit the source file in a Hassio installation? I suppose we cannot access the containers ?

Otherwise, method from @cyr-ius, by adding the integration as custom_component will overload the official one ? Or do I have somethyelse to do in HA ?

Yes, It'll overwrite the official one yes, nothing else to do appart from reloading the integration

Maybe it would be more easy for you to simply downgrade HA to 2023.7.3

EDIT : I was apparently wrong, look @Skuair post

cyclope205 commented 1 year ago

hi, i uploaded the freebox folder on the patch, i added it to custom_components. I reloaded the integration, restarted home assistant, but the problem persists. I must have missed something.

Skuair commented 1 year ago

hi, i uploaded the freebox folder on the patch, i added it to custom_components. I reloaded the integration, restarted home assistant, but the problem persists. I must have missed something.

In fact, same for me, the integration loaded is the official one not the one in custom_components.

Skuair commented 1 year ago

OK, i found : according to the doc, you need to add a "version" property in the manifest.json of the custom_component (https://developers.home-assistant.io/docs/creating_integration_manifest/#version).

Example of mine: image

Then, restart HA and it will work: image

cyclope205 commented 1 year ago

OK, j'ai trouvé : selon la doc, il faut ajouter une propriété "version" dans le manifest.json du custom_component ( https://developers.home-assistant.io/docs/creating_integration_manifest/#version ).

Exemple du mien : image

Ensuite, redémarrez HA et cela fonctionnera : image

did not work for me

Skuair commented 1 year ago

Create a folder "freebox" in /config/custom_components like the screenshot and add all files of https://github.com/cyr-ius/home-assistant/tree/Freebox---Enum-raid-disks/homeassistant/components/freebox inside. Then, edit the manifest.json to add a version property like mine. And finally, restart HA. It worked for me.

NeWoKiKi commented 1 year ago

Hi,

I tried to add files and modify manifest.json adding version but after restarting HA it's still the official integration and not the custom one. Did you change something else ?

Many thanks,

cyclope205 commented 1 year ago

Create a folder "freebox" in /config/custom_components like the screenshot and add all files of https://github.com/cyr-ius/home-assistant/tree/Freebox---Enum-raid-disks/homeassistant/components/freebox inside. Then, edit the manifest.json to add a version property like mine. And finally, restart HA. It worked for me.

I followed your instructions but it still doesn't work. should we remove the official integration?

cyr-ius commented 1 year ago

This Fix #97696 has been merged in 2023.8.1