mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Bump fjaraskupan to 1.0.2 (#57992)
This commit is contained in:
parent
fe8b9caf99
commit
bc5422d737
@ -9,7 +9,7 @@ import logging
|
|||||||
from bleak import BleakScanner
|
from bleak import BleakScanner
|
||||||
from bleak.backends.device import BLEDevice
|
from bleak.backends.device import BLEDevice
|
||||||
from bleak.backends.scanner import AdvertisementData
|
from bleak.backends.scanner import AdvertisementData
|
||||||
from fjaraskupan import Device, State, device_filter
|
from fjaraskupan import UUID_SERVICE, Device, State, device_filter
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -48,7 +48,7 @@ class EntryState:
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Fjäråskupan from a config entry."""
|
"""Set up Fjäråskupan from a config entry."""
|
||||||
|
|
||||||
scanner = BleakScanner()
|
scanner = BleakScanner(filters={"UUIDs": [str(UUID_SERVICE)]})
|
||||||
|
|
||||||
state = EntryState(scanner, {})
|
state = EntryState(scanner, {})
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
@ -57,18 +57,21 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
async def detection_callback(
|
async def detection_callback(
|
||||||
ble_device: BLEDevice, advertisement_data: AdvertisementData
|
ble_device: BLEDevice, advertisement_data: AdvertisementData
|
||||||
) -> None:
|
) -> None:
|
||||||
|
if data := state.devices.get(ble_device.address):
|
||||||
|
_LOGGER.debug(
|
||||||
|
"Update: %s %s - %s", ble_device.name, ble_device, advertisement_data
|
||||||
|
)
|
||||||
|
|
||||||
|
data.device.detection_callback(ble_device, advertisement_data)
|
||||||
|
data.coordinator.async_set_updated_data(data.device.state)
|
||||||
|
else:
|
||||||
if not device_filter(ble_device, advertisement_data):
|
if not device_filter(ble_device, advertisement_data):
|
||||||
return
|
return
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Detection: %s %s - %s", ble_device.name, ble_device, advertisement_data
|
"Detected: %s %s - %s", ble_device.name, ble_device, advertisement_data
|
||||||
)
|
)
|
||||||
|
|
||||||
if data := state.devices.get(ble_device.address):
|
|
||||||
data.device.detection_callback(ble_device, advertisement_data)
|
|
||||||
data.coordinator.async_set_updated_data(data.device.state)
|
|
||||||
else:
|
|
||||||
|
|
||||||
device = Device(ble_device)
|
device = Device(ble_device)
|
||||||
device.detection_callback(ble_device, advertisement_data)
|
device.detection_callback(ble_device, advertisement_data)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import async_timeout
|
|||||||
from bleak import BleakScanner
|
from bleak import BleakScanner
|
||||||
from bleak.backends.device import BLEDevice
|
from bleak.backends.device import BLEDevice
|
||||||
from bleak.backends.scanner import AdvertisementData
|
from bleak.backends.scanner import AdvertisementData
|
||||||
from fjaraskupan import device_filter
|
from fjaraskupan import UUID_SERVICE, device_filter
|
||||||
|
|
||||||
from homeassistant.helpers.config_entry_flow import register_discovery_flow
|
from homeassistant.helpers.config_entry_flow import register_discovery_flow
|
||||||
|
|
||||||
@ -25,7 +25,9 @@ async def _async_has_devices(hass) -> bool:
|
|||||||
if device_filter(device, advertisement_data):
|
if device_filter(device, advertisement_data):
|
||||||
event.set()
|
event.set()
|
||||||
|
|
||||||
async with BleakScanner(detection_callback=detection):
|
async with BleakScanner(
|
||||||
|
detection_callback=detection, filters={"UUIDs": [str(UUID_SERVICE)]}
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
async with async_timeout.timeout(CONST_WAIT_TIME):
|
async with async_timeout.timeout(CONST_WAIT_TIME):
|
||||||
await event.wait()
|
await event.wait()
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/fjaraskupan",
|
"documentation": "https://www.home-assistant.io/integrations/fjaraskupan",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"fjaraskupan==1.0.1"
|
"fjaraskupan==1.0.2"
|
||||||
],
|
],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
"@elupus"
|
"@elupus"
|
||||||
|
@ -646,7 +646,7 @@ fitbit==0.3.1
|
|||||||
fixerio==1.0.0a0
|
fixerio==1.0.0a0
|
||||||
|
|
||||||
# homeassistant.components.fjaraskupan
|
# homeassistant.components.fjaraskupan
|
||||||
fjaraskupan==1.0.1
|
fjaraskupan==1.0.2
|
||||||
|
|
||||||
# homeassistant.components.flipr
|
# homeassistant.components.flipr
|
||||||
flipr-api==1.4.1
|
flipr-api==1.4.1
|
||||||
|
@ -378,7 +378,7 @@ faadelays==0.0.7
|
|||||||
feedparser==6.0.2
|
feedparser==6.0.2
|
||||||
|
|
||||||
# homeassistant.components.fjaraskupan
|
# homeassistant.components.fjaraskupan
|
||||||
fjaraskupan==1.0.1
|
fjaraskupan==1.0.2
|
||||||
|
|
||||||
# homeassistant.components.flipr
|
# homeassistant.components.flipr
|
||||||
flipr-api==1.4.1
|
flipr-api==1.4.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user