mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Add debug logging for bond (#38304)
This commit is contained in:
parent
213496095f
commit
c29f412a70
@ -64,6 +64,7 @@ class BondEntity(Entity):
|
|||||||
)
|
)
|
||||||
self._available = False
|
self._available = False
|
||||||
else:
|
else:
|
||||||
|
_LOGGER.debug("Device state for %s is:\n%s", self.entity_id, state)
|
||||||
if not self._available:
|
if not self._available:
|
||||||
_LOGGER.info("Entity %s has come back", self.entity_id)
|
_LOGGER.info("Entity %s has come back", self.entity_id)
|
||||||
self._available = True
|
self._available = True
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
"""Reusable utilities for the Bond component."""
|
"""Reusable utilities for the Bond component."""
|
||||||
|
import logging
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from bond_api import Action, Bond
|
from bond_api import Action, Bond
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BondDevice:
|
class BondDevice:
|
||||||
"""Helper device class to hold ID and attributes together."""
|
"""Helper device class to hold ID and attributes together."""
|
||||||
@ -14,6 +16,14 @@ class BondDevice:
|
|||||||
self.props = props
|
self.props = props
|
||||||
self._attrs = attrs
|
self._attrs = attrs
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
"""Return readable representation of a bond device."""
|
||||||
|
return {
|
||||||
|
"device_id": self.device_id,
|
||||||
|
"props": self.props,
|
||||||
|
"attrs": self._attrs,
|
||||||
|
}.__repr__()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
"""Get the name of this device."""
|
"""Get the name of this device."""
|
||||||
@ -75,6 +85,8 @@ class BondHub:
|
|||||||
for device_id in device_ids
|
for device_id in device_ids
|
||||||
]
|
]
|
||||||
|
|
||||||
|
_LOGGER.debug("Discovered Bond devices: %s", self._devices)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bond_id(self) -> str:
|
def bond_id(self) -> str:
|
||||||
"""Return unique Bond ID for this hub."""
|
"""Return unique Bond ID for this hub."""
|
||||||
@ -97,5 +109,6 @@ class BondHub:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_bridge(self) -> bool:
|
def is_bridge(self) -> bool:
|
||||||
"""Return if the Bond is a Bond Bridge. If False, it means that it is a Smart by Bond product. Assumes that it is if the model is not available."""
|
"""Return if the Bond is a Bond Bridge."""
|
||||||
|
# If False, it means that it is a Smart by Bond product. Assumes that it is if the model is not available.
|
||||||
return self._version.get("model", "BD-").startswith("BD-")
|
return self._version.get("model", "BD-").startswith("BD-")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user