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
71.77k stars 30.02k forks source link

Devices missing / not discovered in AVM FRITZ!Box Tools #65998

Closed kongo09 closed 2 years ago

kongo09 commented 2 years ago

The problem

The AVM FRITZ!Box Tools integration is not detecting all devices on my network for tracking on 6660 Cable (retail).

What version of Home Assistant Core has the issue?

core-2022.2.3

What was the last working version of Home Assistant Core?

core-2021.12

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

AVM FRITZ!Box Tools

Link to integration documentation on our website

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

Diagnostics information

Will send full details to @chemelli74 on discord as requested

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Problem was described here #65597 but seperated out by request of @chemelli74 here https://github.com/home-assistant/core/issues/65632#issuecomment-1031156090

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

fritz documentation fritz source (message by IssueLinks)

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

Hey there @mammuth, @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! (message by CodeOwnersMention)

Krocko commented 2 years ago

I have the same problem with a 7590..

kongo09 commented 2 years ago

The discovered devices are all on LAN5 which is the internal guest network. The missing devices are all on LAN3 which is the main network.

chemelli74 commented 2 years ago

I have the same problem with a 7590..

More info on your scenario are needed.

Simone

Ede711 commented 2 years ago

Same issue here. I miss about 160 devices from at all 190 devices.

Modell: FRITZ!Box 7590

I recognized that only devices connected to the WiFi of the FritzBox will be shown. Every client connected to LAN is missing. In my case all clients connected through access points or to my switch.

kongo09 commented 2 years ago

Every client connected to LAN is missing

That's interesting. When you connect something to LAN5 on the guest network, does that show up? If yes, then that's the same behaviour that I observe.

kongo09 commented 2 years ago

I just did a little test with fritzconnection.

Is there any reason why the integration is not using the get_active_hosts() call? Or is this a bug in fritzconnection as the Fritz!Box interface in the Mesh setting actually does show all devices, not just a subset.

chemelli74 commented 2 years ago

Is there any reason why the integration is not using the get_active_hosts() call?

Two reasons: with the old call you cannot get mesh roles and you miss some additional info like where you are connected, the ssid, etc.

Or is this a bug in fritzconnection as the Fritz!Box interface in the Mesh setting actually does show all devices, not just a subset.

Probably, do you mind reporting it to the library repo ?

Simone

kongo09 commented 2 years ago

https://github.com/kbr/fritzconnection/issues/144

kongo09 commented 2 years ago

Some further tests show that unfortunately the Fritz!Box 6660 Cable gives an incomplete answer when asked to give the mesh topology. I don't think this is a bug in fritzconnection. The library only delivers what the Fritz!Box delivers.

If there is not some wisdom on the library side of things, the solution would probably be to make use of the hosts that are collected in a dictionary already https://github.com/home-assistant/core/blob/895aee3fb2ca7c0f8d6aeb694019334d47c035e9/homeassistant/components/fritz/common.py#L346

Maybe, having looped over all nodes in the topology, a third loop over the hosts checking self._devices for the macs could add the missing devices?

jgverweij commented 2 years ago

Let me add my logs for the same problem on a 5490.

Diagnostics: config_entry-fritz-a086528afa8c6b41b0afb8794889c6d7.json.txt Log file: home-assistant.log.txt Screenshot: FRITZ!Box 5490 - fritz box

kongo09 commented 2 years ago

same problem on a 5490.

That's interesting. Do I see that right that all devices from LAN1 are missing?

dieneuser commented 2 years ago

I have a similar effect with my Fritz 6660. HA detects my computer via LAN - the status goes to 'home'. Once the computer is turned off, the status remains 'home' until the integration is manually reloaded or HA is restarted.

jgverweij commented 2 years ago

same problem on a 5490.

That's interesting. Do I see that right that all devices from LAN1 are missing?

Not completely. UBNT is available, en is also on LAN1 connected via switch (TL-SG108PE).

Krocko commented 2 years ago

@kongo09 are the changes from your pr working for you without errors? I tried your changes. The devices are all back, but the sensors are missing now.

Logger: homeassistant.components.sensor
Source: custom_components/fritz/sensor.py:280 
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22)) 
First occurred: 07:40:03 (2 occurrences) 
Last logged: 07:40:08

Error while setting up fritz platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/fritz/sensor.py", line 280, in async_setup_entry
    link_properties = await avm_wrapper.async_get_wan_link_properties()
AttributeError: 'AvmWrapper' object has no attribute 'async_get_wan_link_properties'
LucTs commented 2 years ago

Another example of the issue:

In my case all devices which are connected via LAN (incl. Repeaters) are not available anymore within the integration. Devices connected via Wifi are available as usual.

All my LAN devices are connected to LAN2 on FritzBox because my central switch in the basement of my house is connected to LAN2. The devices itself are connected to the switch.

FritzBox LAN2 --> Switch Switch --> Repeater 1 Switch --> Repeater 2 Switch --> Repeater 3 Switch --> Raspberry

Fritz

LucTs commented 2 years ago

Update: Devices connected to LAN port of FritzBox are available in HA.not directly attached to the FritzBox but are behind the switch are not available within the integration.

Summary: FritzBox Wifi -> x devices - available in HA FritzBox LAN3 --> device - available in HA FritzBox LAN2 --> Switch -> x devices - not available in HA

jgverweij commented 2 years ago

In my case, with 2022.2.5 there are 2 more devices available but still not all.

It seems that the WiFi devices which are after the UBNT accesspoint are missing.

Update 1: Fritz -> TP-SG108PE switch -> Ubiquity UBNT accesspoint -> wifi devices

Update 2: But device Dahua, which is connected directly to the switch TP-SG108PE is also not available.

jaegerschnitzel commented 2 years ago

My FRITZ!Box is connected only to one switch where all other devices and APs are connected. I have still only FRITZ!Box itself available as Home Assistant device :(

kongo09 commented 2 years ago

are the changes from your pr working for you without errors?

@Krocko Yes, no errors. Are you sure you just applied my PR and nothing else?

However, I did notice that the switches are not working. I'll take another look.

Rangitoto1980 commented 2 years ago

My situation seems to be very similar to @LucTs '.

Since updating to 2022.2.x I am also missing some device_trackers which are now shown as unavailable.

Krocko commented 2 years ago

@Krocko Yes, no errors. Are you sure you just applied my PR and nothing else?

Yes. Testet with 2022.2.3 and 2022.2.5

Switches and Buttons working for me.

chemelli74 commented 2 years ago

https://github.com/home-assistant/core/issues/66402#issuecomment-1046257231

chemelli74 commented 2 years ago

Anyone available to test a fix ?

If so please join HomeAssistant on Discord and then contact me: chemelli74#2180

Simone