JeffLIrion / python-androidtv

Communicate with an Android TV or Fire TV device via ADB over a network.
MIT License
160 stars 57 forks source link

Missing connection state awareness results in endless connection attempt loops (Android TV powered off) and log flooding #320

Open bcutter opened 2 years ago

bcutter commented 2 years ago

I discovered the same as this user here, unfortunately it seems he didn't raise an issue in this repo as recommended at the end of the issue:

Android TV integration very chatty in log when configured Android TV device is not available (turned off) https://github.com/home-assistant/core/issues/69672 (here the problem is already described)

Problem: python-androidtv constantly (every 80 seconds) trys to connect to the tv. If it is powered off, it will go on like forever. On every failed connect attempt an error is written to the log. This floods logs pretty fast pretty heavily.

This is what Home Assistant log contains for ONE single failed connection attempt:

Logger: androidtv.adb_manager.adb_manager_async
Source: /usr/local/lib/python3.9/site-packages/androidtv/adb_manager/adb_manager_async.py:298
First occurred: 30. Mai 2022, 16:21:17 (1445 occurrences)
Last logged: 00:50:11

Couldn't connect to xxx.xxx.xxx.xxx:5555. TcpTimeoutException: Connecting to xxx.xxx.xxx.xxx:5555 timed out (1.0 seconds)

This is what HA's GUI presents: grafik

The experts from HA (see referenced issue) told this is nothing HA can fix but this only can to be done in this library repo.

By the way: Not related to https://github.com/JeffLIrion/python-androidtv/issues/15

JeffLIrion commented 2 years ago

https://github.com/JeffLIrion/python-androidtv/blob/f63687a96fc222eedb5f2fd852fc729f92d33a47/androidtv/setup_async.py#L23

As long as HA continues to call setup with log_errors=True, this package will continue to log failed setup attempts. This should be fixed in HA.

bcutter commented 2 years ago

Ah come on guys... you ping pong users from one side to the other :-D Why don't you talk with each other to find a solution ;-)

So here we go: https://github.com/home-assistant/core/issues/72851

JeffLIrion commented 2 years ago

Until someone submits a fix, I suggest setting the log level to critical for the Android TV integration.

bcutter commented 2 years ago

That's a workaround. So let's look/wait for a fix.

kevincaradant commented 1 year ago

Hi any news about this? :)

I have hundred and hundred message like that, just after 1 or 2 days :(. The other thread is locked, I can't open it again

Thanks