How to disable esphome logger for just one switch?

I have two switches in my esphome device and I would like to disable logging for just one of the switches. Can I do this? The reason is that one of them is included in a little loop to flash an LED and this constant turning on and off spams the logs:

[11:38:26][D][switch:013]: 'esphome_windowsensor1_whiteled' Turning ON.
[11:38:26][D][switch:013]: 'led_pin' Turning ON.
[11:38:26][D][switch:037]: 'led_pin': Sending state ON
[11:38:26][D][switch:037]: 'esphome_windowsensor1_whiteled': Sending state ON
[11:38:26][D][switch:017]: 'led_pin' Turning OFF.
[11:38:26][D][switch:037]: 'led_pin': Sending state OFF
[11:38:27][D][switch:013]: 'led_pin' Turning ON.
[11:38:27][D][switch:037]: 'led_pin': Sending state ON
[11:38:27][D][switch:017]: 'led_pin' Turning OFF.
[11:38:27][D][switch:037]: 'led_pin': Sending state OFF
[11:38:27][D][switch:013]: 'led_pin' Turning ON.
[11:38:27][D][switch:037]: 'led_pin': Sending state ON
[11:38:27][D][switch:017]: 'led_pin' Turning OFF.
[11:38:27][D][switch:037]: 'led_pin': Sending state OFF
[11:38:28][D][switch:013]: 'led_pin' Turning ON.
[11:38:28][D][switch:037]: 'led_pin': Sending state ON
[11:38:28][D][switch:017]: 'led_pin' Turning OFF.
[11:38:28][D][switch:037]: 'led_pin': Sending state OFF
[11:38:28][D][switch:013]: 'led_pin' Turning ON.
[11:38:28][D][switch:037]: 'led_pin': Sending state ON
[11:38:28][D][switch:017]: 'led_pin' Turning OFF.
[11:38:28][D][switch:037]: 'led_pin': Sending state OFF
[11:38:29][D][switch:013]: 'led_pin' Turning ON.
[11:38:29][D][switch:037]: 'led_pin': Sending state ON
[11:38:29][D][switch:017]: 'led_pin' Turning OFF.
[11:38:29][D][switch:037]: 'led_pin': Sending state OFF
[11:38:29][D][switch:013]: 'led_pin' Turning ON.
[11:38:29][D][switch:037]: 'led_pin': Sending state ON
[11:38:29][D][switch:017]: 'led_pin' Turning OFF.
[11:38:30][D][switch:037]: 'led_pin': Sending state OFF
[11:38:30][D][switch:013]: 'led_pin' Turning ON.
[11:38:30][D][switch:037]: 'led_pin': Sending state ON
[11:38:30][D][switch:017]: 'esphome_windowsensor1_whiteled' Turning OFF.
[11:38:30][D][switch:017]: 'led_pin' Turning OFF.
[11:38:30][D][switch:037]: 'led_pin': Sending state OFF
[11:38:30][D][switch:037]: 'esphome_windowsensor1_whiteled': Sending state OFF

So in this example, I’d like the “led_pin” turning on and off to be removed from the log output, but keep the “esphome_windowsensor1_whiteled” ones.

Have a look at exclude entities.

Have a look here you can tag an entity and then exclude it

This is for esphome, not Home Assistant, but thanks anyway :slightly_smiling_face:

I can see in there that you can disable switches from logging at all, i.e. the whole component, but I want one switch to log and the other not to log.

You are correct, I did not read it carefully. Maybe put in a feature request ?

1 Like

You can’t exclude only one entity, only whole group (say, all switches…). I’ve already asked dev on github a while ago. Supposely it’s not in a future plan either.

Ah I see, thanks.