Silencing particular error

Hi,
I am getting lots of the following log messages when I disconnect my Android TV box from the network.
How I can silence those two log messages? I know I’ve disconnected the box, the error is expected.

2023-05-08 04:04:36.364 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn't connect to *********:5555.  TcpTimeoutException: Connecting to *********:5555 timed out (1.0 seconds)
2023-05-08 04:43:42.211 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 *********:5555 timed out (9.0 seconds)
1 Like
logger:
  default: warning
  logs:
    # log level for Android TV integration
    homeassistant.components.androidtv: critical

But this will silence ALL androidtv errors, not just the two I’ve mentioned. I want to know about other errors, just not this two.

Yeah, should’ve read the link and not rely on my “experience” :slight_smile: There is actually a way to filter logs in the link above.

@fisz: So what does your final solution look like?

I want to specifically ignore those:

Logger: androidtv.adb_manager.adb_manager_async
Source: components/androidtv/__init__.py:123
First occurred: 29. August 2023 um 00:19:38 (2239 occurrences)
Last logged: 11:18:55

Couldn't connect to xxx.xxx.xxx.xxx:5555. TcpTimeoutException: Connecting to xxx.xxx.xxx.xxx:5555 timed out (1.0 seconds)
Couldn't connect to xxx.xxx.xxx.yyy:5555. TcpTimeoutException: Connecting to xxx.xxx.xxx.yyy:5555 timed out (1.0 seconds)
Couldn't connect to xxx.xxx.xxx.xxx:5555. OSError: Connect call failed ('xxx.xxx.xxx.xxx', 5555)
Couldn't connect to xxx.xxx.xxx.yyy:5555. OSError: Connect call failed ('xxx.xxx.xxx.yyy', 5555)

Would according to Logger - Home Assistant this work?

logger:
  [...]
  filters:
    homeassistant.components.androidtv:
      - "TcpTimeoutException: Connecting to"
      - "OSError: Connect call failed"

Unfortunately HA needs a restart to test this (as there’s only a service for setting the log level but not for applying filters) - which is not possible at the moment and a bit annoying. So I want to make sure the first shot is right.

Unfortunately not even THIS is working:

logger:
  default: warning
  logs:
    homeassistant.components.androidtv: error

Still I have plenty of warnings of this integration:
grafik

What’s wrong here???

What happened when you tried the filter approach ?
I’ve used that before in the past and it works well.

It simply didn’t work too. Meaning they were not filtered. Also tried few RegEx iterations after that, nothing.

Currently neither using filters: nor setting the log level for a whole integration is working.

Out of ideas & annoyance level 10.000 :slightly_frowning_face: :slightly_frowning_face: :slightly_frowning_face:

Update: also using

service: logger.set_level
data:
  homeassistant.components.androidtv: error

from services section did not work. Still receive warning log entries from that integration on a per minute basis. Even if it would work then it’s possibly not permanent (not HA restart persistent, that’s what the logger section in configuration.yaml is for), isn’t it? And it’s not possible to filter specific log entries anyway. Back to start! :slightly_frowning_face:

I’ve successfully silenced errors with this for example:

  logs:
  filters:
      zigpy.device:
        - "because Data is too short to contain . bytes"

So yours would look something like:

  logs:
  filters:
      androidtv.adb_manager.adb_manager_async:
        - "Protokolldetails"

Well that looks different to what I used/tried before:

  filters:
    homeassistant.components.androidtv:
  filters:
    androidtv.adb_manager.adb_manager_async:

I’ll give that a try, even I absolutely don’t get the convention of referencing integrations/log sources…

You should be silencing the logger, not the component.

Did you finally find a solution to silencing the specific error?

logger:
  default: info
  filters:
    androidtv.adb_manager.adb_manager_async:
      - "Couldn't connect"
    homeassistant.components.androidtv.media_player:
      - "Error: Reading from .* timed out"
1 Like