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:
J. Nick Koston 2024-05-05 15:37:10 -05:00 committed by GitHub
parent 2964471e19
commit d970c19342
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 4 deletions

View File

@ -16,7 +16,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
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]
@ -66,6 +66,12 @@ async def async_setup_entry(
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)
entry.runtime_data = coordinator
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

View File

@ -7,3 +7,5 @@ VOLUME_BECQUEREL = "Bq/m³"
VOLUME_PICOCURIE = "pCi/L"
DEFAULT_SCAN_INTERVAL = 300
MAX_RETRIES_AFTER_STARTUP = 5

View File

@ -24,5 +24,5 @@
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/airthings_ble",
"iot_class": "local_polling",
"requirements": ["airthings-ble==0.8.0"]
"requirements": ["airthings-ble==0.9.0"]
}

View File

@ -413,7 +413,7 @@ aioymaps==1.2.2
airly==1.1.0
# homeassistant.components.airthings_ble
airthings-ble==0.8.0
airthings-ble==0.9.0
# homeassistant.components.airthings
airthings-cloud==0.2.0

View File

@ -386,7 +386,7 @@ aioymaps==1.2.2
airly==1.1.0
# homeassistant.components.airthings_ble
airthings-ble==0.8.0
airthings-ble==0.9.0
# homeassistant.components.airthings
airthings-cloud==0.2.0