mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 19:48:23 +00:00
Fix airthings-ble data drop outs when Bluetooth connection is flakey (#116805)
* Fix airthings-ble data drop outs when Bluetooth adapter is flakey fixes #116770 * add missing file * update
This commit is contained in:
parent
dbe303d95e
commit
ae28c604e5
@ -16,7 +16,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
|||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||||
|
|
||||||
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN
|
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN, MAX_RETRIES_AFTER_STARTUP
|
||||||
|
|
||||||
PLATFORMS: list[Platform] = [Platform.SENSOR]
|
PLATFORMS: list[Platform] = [Platform.SENSOR]
|
||||||
|
|
||||||
@ -61,6 +61,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
|
# Once its setup and we know we are not going to delay
|
||||||
|
# the startup of Home Assistant, we can set the max attempts
|
||||||
|
# to a higher value. If the first connection attempt fails,
|
||||||
|
# Home Assistant's built-in retry logic will take over.
|
||||||
|
airthings.set_max_attempts(MAX_RETRIES_AFTER_STARTUP)
|
||||||
|
|
||||||
hass.data[DOMAIN][entry.entry_id] = coordinator
|
hass.data[DOMAIN][entry.entry_id] = coordinator
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
@ -7,3 +7,5 @@ VOLUME_BECQUEREL = "Bq/m³"
|
|||||||
VOLUME_PICOCURIE = "pCi/L"
|
VOLUME_PICOCURIE = "pCi/L"
|
||||||
|
|
||||||
DEFAULT_SCAN_INTERVAL = 300
|
DEFAULT_SCAN_INTERVAL = 300
|
||||||
|
|
||||||
|
MAX_RETRIES_AFTER_STARTUP = 5
|
||||||
|
@ -24,5 +24,5 @@
|
|||||||
"dependencies": ["bluetooth_adapters"],
|
"dependencies": ["bluetooth_adapters"],
|
||||||
"documentation": "https://www.home-assistant.io/integrations/airthings_ble",
|
"documentation": "https://www.home-assistant.io/integrations/airthings_ble",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"requirements": ["airthings-ble==0.8.0"]
|
"requirements": ["airthings-ble==0.9.0"]
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ aioymaps==1.2.2
|
|||||||
airly==1.1.0
|
airly==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.airthings_ble
|
# homeassistant.components.airthings_ble
|
||||||
airthings-ble==0.8.0
|
airthings-ble==0.9.0
|
||||||
|
|
||||||
# homeassistant.components.airthings
|
# homeassistant.components.airthings
|
||||||
airthings-cloud==0.2.0
|
airthings-cloud==0.2.0
|
||||||
|
@ -386,7 +386,7 @@ aioymaps==1.2.2
|
|||||||
airly==1.1.0
|
airly==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.airthings_ble
|
# homeassistant.components.airthings_ble
|
||||||
airthings-ble==0.8.0
|
airthings-ble==0.9.0
|
||||||
|
|
||||||
# homeassistant.components.airthings
|
# homeassistant.components.airthings
|
||||||
airthings-cloud==0.2.0
|
airthings-cloud==0.2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user