mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Bump pySwitchbot to 0.20.0 for bleak 0.19 changes (#80389)
This commit is contained in:
parent
40600991b3
commit
bbe63bca47
@ -60,7 +60,6 @@ class SwitchbotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator):
|
|||||||
self.device_name = device_name
|
self.device_name = device_name
|
||||||
self.base_unique_id = base_unique_id
|
self.base_unique_id = base_unique_id
|
||||||
self.model = model
|
self.model = model
|
||||||
self.service_info: bluetooth.BluetoothServiceInfoBleak | None = None
|
|
||||||
self._ready_event = asyncio.Event()
|
self._ready_event = asyncio.Event()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
@ -71,7 +70,6 @@ class SwitchbotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator):
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Handle a Bluetooth event."""
|
"""Handle a Bluetooth event."""
|
||||||
self.ble_device = service_info.device
|
self.ble_device = service_info.device
|
||||||
self.service_info = service_info
|
|
||||||
if adv := switchbot.parse_advertisement_data(
|
if adv := switchbot.parse_advertisement_data(
|
||||||
service_info.device, service_info.advertisement
|
service_info.device, service_info.advertisement
|
||||||
):
|
):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "switchbot",
|
"domain": "switchbot",
|
||||||
"name": "SwitchBot",
|
"name": "SwitchBot",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/switchbot",
|
"documentation": "https://www.home-assistant.io/integrations/switchbot",
|
||||||
"requirements": ["PySwitchbot==0.19.15"],
|
"requirements": ["PySwitchbot==0.20.0"],
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"dependencies": ["bluetooth"],
|
"dependencies": ["bluetooth"],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Support for SwitchBot sensors."""
|
"""Support for SwitchBot sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from homeassistant.components.bluetooth import async_last_service_info
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
SensorDeviceClass,
|
SensorDeviceClass,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
@ -106,7 +107,7 @@ class SwitchBotSensor(SwitchbotEntity, SensorEntity):
|
|||||||
self.entity_description = SENSOR_TYPES[sensor]
|
self.entity_description = SENSOR_TYPES[sensor]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> str | int:
|
def native_value(self) -> str | int | None:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self.data["data"][self._sensor]
|
return self.data["data"][self._sensor]
|
||||||
|
|
||||||
@ -115,7 +116,14 @@ class SwitchbotRSSISensor(SwitchBotSensor):
|
|||||||
"""Representation of a Switchbot RSSI sensor."""
|
"""Representation of a Switchbot RSSI sensor."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> str | int:
|
def native_value(self) -> str | int | None:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
assert self.coordinator.service_info is not None
|
# Switchbot supports both connectable and non-connectable devices
|
||||||
return self.coordinator.service_info.rssi
|
# 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
|
PySocks==1.7.1
|
||||||
|
|
||||||
# homeassistant.components.switchbot
|
# homeassistant.components.switchbot
|
||||||
PySwitchbot==0.19.15
|
PySwitchbot==0.20.0
|
||||||
|
|
||||||
# homeassistant.components.transport_nsw
|
# homeassistant.components.transport_nsw
|
||||||
PyTransportNSW==0.1.1
|
PyTransportNSW==0.1.1
|
||||||
|
@ -33,7 +33,7 @@ PyRMVtransport==0.3.3
|
|||||||
PySocks==1.7.1
|
PySocks==1.7.1
|
||||||
|
|
||||||
# homeassistant.components.switchbot
|
# homeassistant.components.switchbot
|
||||||
PySwitchbot==0.19.15
|
PySwitchbot==0.20.0
|
||||||
|
|
||||||
# homeassistant.components.transport_nsw
|
# homeassistant.components.transport_nsw
|
||||||
PyTransportNSW==0.1.1
|
PyTransportNSW==0.1.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user