Logger configuration for custom components

Dear,

I have quite some errors in my log related to my circadian lighting compenent. Errors are mainly due to the fact that some of these lights are off (power-off) and can’t be updated at that moment. This is fine for me.

However, I would like to skip these errors in my logfile. I added following in my configuration.yaml

logger:
  default: warn
  logs:
    homeassistant.components.media_player: error
    homeassistant.components.http: warning
    custom_components.circadian_lighting: critical

but this doesn’t seem to work as I still get following:

Logger: homeassistant.util.logging
Source: util/logging.py:105
First occurred: 6 November 2021, 15:09:30 (229 occurrences)
Last logged: 09:59:31

Exception in _update_switch when dispatching 'circadian_lighting_update': () Traceback (most recent call last): File "/config/custom_components/circadian_lighting/switch.py", line 323, in _update_switch await self._adjust_lights(lights or self._lights, transition) File "/config/custom_components/circadian_lighting/switch.py", line 344, in _adjust_lights if not self._should_adjust(): File "/config/custom_components/circadian_lighting/switch.py", line 339, in _should_adjust if self._is_disabled(): File "/config/custom_components/circadian_lighting/switch.py", line 333, in _is_disabled and self.hass.states.get(self._disable_entity).state in self._disable_state AttributeError: 'NoneType' object has no attribute 'state'

Am I missing something?

Take a look in home-assistant.log for the errors.

Use the string between the two square brackets for the logger configuration.

For example:

2021-11-07 11:20:24 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition
                                         ^                                   ^
logger:
  default: warn
  logs:
    homeassistant.components.automation: critical

Thank you for your reply/advice

The log indicates following:

2021-11-06 15:24:30 ERROR (MainThread) [homeassistant.util.logging] Exception in _update_switch when dispatching 'circadian_lighting_update': ()

This would mean I have use “homeassistant.util.logging” in my configuration to suppress the logs if I understand your feedback correctly.

This seems a quite generic component, no idea what else I will suppress :wink:

Value update, let’s see the impact.

There are also log filters for a finer selection.

Thanks for the tips! I will further experiment with the filters.

Case can be closed. Have a nice sunday!