Allow parsing to happen in PassiveBluetoothProcessorCoordinator (#76384)

This commit is contained in:
Jc2k 2022-08-09 06:36:39 +01:00 committed by GitHub
parent 12721da063
commit 7d427ddbd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 288 additions and 130 deletions

View file

@ -3,14 +3,7 @@ from __future__ import annotations
from typing import Optional, Union
from sensorpush_ble import (
DeviceClass,
DeviceKey,
SensorDeviceInfo,
SensorPushBluetoothDeviceData,
SensorUpdate,
Units,
)
from sensorpush_ble import DeviceClass, DeviceKey, SensorDeviceInfo, SensorUpdate, Units
from homeassistant import config_entries
from homeassistant.components.bluetooth.passive_update_processor import (
@ -130,12 +123,7 @@ async def async_setup_entry(
coordinator: PassiveBluetoothProcessorCoordinator = hass.data[DOMAIN][
entry.entry_id
]
data = SensorPushBluetoothDeviceData()
processor = PassiveBluetoothDataProcessor(
lambda service_info: sensor_update_to_bluetooth_data_update(
data.update(service_info)
)
)
processor = PassiveBluetoothDataProcessor(sensor_update_to_bluetooth_data_update)
entry.async_on_unload(
processor.async_add_entities_listener(
SensorPushBluetoothSensorEntity, async_add_entities