Bump pySwitchbot to 0.20.0 for bleak 0.19 changes (#80389)
This commit is contained in:
parent
40600991b3
commit
bbe63bca47
5 changed files with 15 additions and 9 deletions
|
@ -60,7 +60,6 @@ class SwitchbotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator):
|
|||
self.device_name = device_name
|
||||
self.base_unique_id = base_unique_id
|
||||
self.model = model
|
||||
self.service_info: bluetooth.BluetoothServiceInfoBleak | None = None
|
||||
self._ready_event = asyncio.Event()
|
||||
|
||||
@callback
|
||||
|
@ -71,7 +70,6 @@ class SwitchbotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator):
|
|||
) -> None:
|
||||
"""Handle a Bluetooth event."""
|
||||
self.ble_device = service_info.device
|
||||
self.service_info = service_info
|
||||
if adv := switchbot.parse_advertisement_data(
|
||||
service_info.device, service_info.advertisement
|
||||
):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"domain": "switchbot",
|
||||
"name": "SwitchBot",
|
||||
"documentation": "https://www.home-assistant.io/integrations/switchbot",
|
||||
"requirements": ["PySwitchbot==0.19.15"],
|
||||
"requirements": ["PySwitchbot==0.20.0"],
|
||||
"config_flow": true,
|
||||
"dependencies": ["bluetooth"],
|
||||
"codeowners": [
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Support for SwitchBot sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.bluetooth import async_last_service_info
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
|
@ -106,7 +107,7 @@ class SwitchBotSensor(SwitchbotEntity, SensorEntity):
|
|||
self.entity_description = SENSOR_TYPES[sensor]
|
||||
|
||||
@property
|
||||
def native_value(self) -> str | int:
|
||||
def native_value(self) -> str | int | None:
|
||||
"""Return the state of the sensor."""
|
||||
return self.data["data"][self._sensor]
|
||||
|
||||
|
@ -115,7 +116,14 @@ class SwitchbotRSSISensor(SwitchBotSensor):
|
|||
"""Representation of a Switchbot RSSI sensor."""
|
||||
|
||||
@property
|
||||
def native_value(self) -> str | int:
|
||||
def native_value(self) -> str | int | None:
|
||||
"""Return the state of the sensor."""
|
||||
assert self.coordinator.service_info is not None
|
||||
return self.coordinator.service_info.rssi
|
||||
# Switchbot supports both connectable and non-connectable devices
|
||||
# so we need to request the rssi value based on the connectable instead
|
||||
# of the nearest scanner since that is the RSSI that matters for controlling
|
||||
# the device.
|
||||
if service_info := async_last_service_info(
|
||||
self.hass, self._address, self.coordinator.connectable
|
||||
):
|
||||
return service_info.rssi
|
||||
return None
|
||||
|
|
|
@ -37,7 +37,7 @@ PyRMVtransport==0.3.3
|
|||
PySocks==1.7.1
|
||||
|
||||
# homeassistant.components.switchbot
|
||||
PySwitchbot==0.19.15
|
||||
PySwitchbot==0.20.0
|
||||
|
||||
# homeassistant.components.transport_nsw
|
||||
PyTransportNSW==0.1.1
|
||||
|
|
|
@ -33,7 +33,7 @@ PyRMVtransport==0.3.3
|
|||
PySocks==1.7.1
|
||||
|
||||
# homeassistant.components.switchbot
|
||||
PySwitchbot==0.19.15
|
||||
PySwitchbot==0.20.0
|
||||
|
||||
# homeassistant.components.transport_nsw
|
||||
PyTransportNSW==0.1.1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue