added utility to make macs loggable
This commit is contained in:
1 parent
e0c7ada147
commit
43be1e1dbe
10 files changed
+57
-42
No files matched your search
@@ -28,6 +28,7 @@ from bluetti_mqtt.mqtt_client import (
|
||||
from . import device_info as dev_info, get_unique_id
|
||||
from .const import DATA_COORDINATOR, DOMAIN, ADDITIONAL_DEVICE_FIELDS
|
||||
from .coordinator import PollingCoordinator, DummyDevice
|
||||
from .utils import unique_id_loggable
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -103,10 +104,10 @@ class BluettiBinarySensor(CoordinatorEntity, BinarySensorEntity):
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
_LOGGER.debug("Updating state of %s", self._attr_unique_id)
|
||||
_LOGGER.debug("Updating state of %s", unique_id_loggable(self._attr_unique_id))
|
||||
if not isinstance(self.coordinator.data, dict):
|
||||
_LOGGER.debug(
|
||||
"Invalid data from coordinator (binary_sensor.%s)", self._attr_unique_id
|
||||
"Invalid data from coordinator (binary_sensor.%s)", unique_id_loggable(self._attr_unique_id)
|
||||
)
|
||||
self._attr_available = False
|
||||
return
|
||||
@@ -119,7 +120,7 @@ class BluettiBinarySensor(CoordinatorEntity, BinarySensorEntity):
|
||||
if not isinstance(response_data, bool):
|
||||
_LOGGER.warning(
|
||||
"Invalid response data type from coordinator (binary_sensor.%s): %s",
|
||||
self._attr_unique_id,
|
||||
unique_id_loggable(self._attr_unique_id),
|
||||
response_data,
|
||||
)
|
||||
self._attr_available = False
|
||||
|
||||
Reference in new issue
Block a user