Skip to content

Commit

Permalink
Avoid home assistant filling debug logs with low value logging line e…
Browse files Browse the repository at this point in the history
…very time we update sensors (#744)
  • Loading branch information
AdrianGarside authored Nov 16, 2024
1 parent baf0011 commit ec7c825
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions custom_components/bambu_lab/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
BRAND = "Bambu Lab"

LOGGER = logging.getLogger(__package__)
LOGGERFORHA = logging.getLogger(f"{DOMAIN}_HA")

PLATFORMS = (
Platform.BINARY_SENSOR,
Expand Down
9 changes: 6 additions & 3 deletions custom_components/bambu_lab/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
BRAND,
DOMAIN,
LOGGER,
LOGGERFORHA
)
import asyncio
from typing import Any
Expand All @@ -12,8 +13,8 @@
from homeassistant.helpers import device_registry
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback
from homeassistant.const import CONF_HOST, EVENT_HOMEASSISTANT_STOP, Platform
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, Platform

import paho.mqtt.client as mqtt

Expand All @@ -38,9 +39,11 @@ def __init__(self, hass, *, entry: ConfigEntry) -> None:
self._updatedDevice = False
self.data = self.get_model()
self._eventloop = asyncio.get_running_loop()
# Pass LOGGERFORHA logger into HA as otherwise it generates a debug output line every single time we tell it we have an update
# which fills the logs and makes the useful logging data less accessible.
super().__init__(
hass,
LOGGER,
LOGGERFORHA,
name=DOMAIN
)

Expand Down

0 comments on commit ec7c825

Please sign in to comment.