mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix switchbot not accepting the first advertisement (#78610)
This commit is contained in:
parent
f7ef9eb91b
commit
b8ccf53799
@ -110,7 +110,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
)
|
)
|
||||||
entry.async_on_unload(coordinator.async_start())
|
entry.async_on_unload(coordinator.async_start())
|
||||||
if not await coordinator.async_wait_ready():
|
if not await coordinator.async_wait_ready():
|
||||||
raise ConfigEntryNotReady(f"Switchbot {sensor_type} with {address} not ready")
|
raise ConfigEntryNotReady(f"{address} is not advertising state")
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
||||||
await hass.config_entries.async_forward_entry_setups(
|
await hass.config_entries.async_forward_entry_setups(
|
||||||
|
@ -73,7 +73,7 @@ class SwitchbotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator):
|
|||||||
if adv := switchbot.parse_advertisement_data(
|
if adv := switchbot.parse_advertisement_data(
|
||||||
service_info.device, service_info.advertisement
|
service_info.device, service_info.advertisement
|
||||||
):
|
):
|
||||||
if "modelName" in self.data:
|
if "modelName" in adv.data:
|
||||||
self._ready_event.set()
|
self._ready_event.set()
|
||||||
_LOGGER.debug("%s: Switchbot data: %s", self.ble_device.address, self.data)
|
_LOGGER.debug("%s: Switchbot data: %s", self.ble_device.address, self.data)
|
||||||
if not self.device.advertisement_changed(adv):
|
if not self.device.advertisement_changed(adv):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user