Remove extra connection attempt, rm callback debug login when not connected
This commit is contained in:
1 parent
3a662964b8
commit
0cadbb9931
4 files changed
+12
-16
No files matched your search
@@ -104,6 +104,10 @@ class BluettiBinarySensor(CoordinatorEntity, BinarySensorEntity):
|
|||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
"""Handle updated data from the coordinator."""
|
"""Handle updated data from the coordinator."""
|
||||||
|
|
||||||
|
if not self.coordinator.client.is_connected:
|
||||||
|
return
|
||||||
|
|
||||||
_LOGGER.debug("Updating state of %s", unique_id_loggable(self._attr_unique_id))
|
_LOGGER.debug("Updating state of %s", unique_id_loggable(self._attr_unique_id))
|
||||||
if not isinstance(self.coordinator.data, dict):
|
if not isinstance(self.coordinator.data, dict):
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
|
|||||||
@@ -179,22 +179,6 @@ class PollingCoordinator(DataUpdateCoordinator):
|
|||||||
|
|
||||||
parsed_data: dict = {}
|
parsed_data: dict = {}
|
||||||
|
|
||||||
# Connect to device
|
|
||||||
try:
|
|
||||||
async with async_timeout.timeout(20):
|
|
||||||
await self.client.connect()
|
|
||||||
|
|
||||||
await self.client.start_notify(
|
|
||||||
BluetoothClient.NOTIFY_UUID, self._notification_handler
|
|
||||||
)
|
|
||||||
self.has_notifier = True
|
|
||||||
except TimeoutError:
|
|
||||||
self.logger.debug("Connection timed out for device %s", mac_loggable(self._address))
|
|
||||||
return None
|
|
||||||
except BleakError as err:
|
|
||||||
self.logger.debug("Bleak error: %s", err)
|
|
||||||
return None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with async_timeout.timeout(15):
|
async with async_timeout.timeout(15):
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ class BluettiSensor(CoordinatorEntity, SensorEntity):
|
|||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
"""Handle updated data from the coordinator."""
|
"""Handle updated data from the coordinator."""
|
||||||
|
|
||||||
|
if not self.coordinator.client.is_connected:
|
||||||
|
return
|
||||||
|
|
||||||
_LOGGER.debug("Updating state of %s", unique_id_loggable(self._attr_unique_id))
|
_LOGGER.debug("Updating state of %s", unique_id_loggable(self._attr_unique_id))
|
||||||
if not isinstance(self.coordinator.data, dict):
|
if not isinstance(self.coordinator.data, dict):
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
|
|||||||
@@ -114,6 +114,10 @@ class BluettiSwitch(CoordinatorEntity, SwitchEntity):
|
|||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
"""Handle updated data from the coordinator."""
|
"""Handle updated data from the coordinator."""
|
||||||
|
|
||||||
|
if not self.coordinator.client.is_connected:
|
||||||
|
return
|
||||||
|
|
||||||
_LOGGER.debug("Updating state of %s", unique_id_loggable(self._attr_unique_id))
|
_LOGGER.debug("Updating state of %s", unique_id_loggable(self._attr_unique_id))
|
||||||
if not isinstance(self.coordinator.data, dict):
|
if not isinstance(self.coordinator.data, dict):
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
|
|||||||
Reference in new issue
Block a user