AndroidTV via adb should not spam log with TcpTimeoutExceptions if TV is off

I’m using the Android-TV via adb integration to turn on my backlight if the TV starts playing.

However, when the TV is off, the log is spammed with:

2024-02-26 14:40:17.986 ERROR (MainThread) [homeassistant.components.androidtv.media_player] Failed to execute an ADB command. ADB connection re-establishing attempt in the next update. Error: Reading from 192.168.11.35:5555 timed out (9.0 seconds)
2024-02-26 14:40:19.987 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn't connect to 192.168.11.35:5555.  TcpTimeoutException: Connecting to 192.168.11.35:5555 timed out (1.0 seconds)

IMHO these should be DEBUG messages so that they don’t spam the log.

Opinions?

Did you succeed to get it reliable ? here with TV Sony it’s barely usable as it looses connection all the time with the device without any reason and as you pollute logs in an insane way :frowning:

1 Like

I only use it for that, and that works totally reliably so far. But of course it’s far from magic, and works nicely with a short delay only while the integration retries and checks if the TV has come online.

Mine’s the same. You can filter the errors out of the logs:

logger:
# Ignore regular log messages below ERROR
  default: error
# Errors resulting from TV being switched off  
  filters:  
    homeassistant.components.androidtv.media_player:
      - "Failed to execute an ADB command*"
2 Likes

Done. Thanks for the code. There really should be a fix for that, OP is right…

1 Like