mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
switchbot_cloud: Add battery sensor for Bot and Smart Locks (#143689)
This commit is contained in:
parent
a6d5891e8a
commit
5ccb9486e0
@ -140,11 +140,13 @@ async def make_device_data(
|
|||||||
hass, entry, api, device, coordinators_by_id
|
hass, entry, api, device, coordinators_by_id
|
||||||
)
|
)
|
||||||
devices_data.locks.append((device, coordinator))
|
devices_data.locks.append((device, coordinator))
|
||||||
|
devices_data.sensors.append((device, coordinator))
|
||||||
|
|
||||||
if isinstance(device, Device) and device.device_type in ["Bot"]:
|
if isinstance(device, Device) and device.device_type in ["Bot"]:
|
||||||
coordinator = await coordinator_for_device(
|
coordinator = await coordinator_for_device(
|
||||||
hass, entry, api, device, coordinators_by_id
|
hass, entry, api, device, coordinators_by_id
|
||||||
)
|
)
|
||||||
|
devices_data.sensors.append((device, coordinator))
|
||||||
if coordinator.data is not None:
|
if coordinator.data is not None:
|
||||||
if coordinator.data.get("deviceMode") == "pressMode":
|
if coordinator.data.get("deviceMode") == "pressMode":
|
||||||
devices_data.buttons.append((device, coordinator))
|
devices_data.buttons.append((device, coordinator))
|
||||||
|
@ -90,6 +90,7 @@ CO2_DESCRIPTION = SensorEntityDescription(
|
|||||||
)
|
)
|
||||||
|
|
||||||
SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = {
|
SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = {
|
||||||
|
"Bot": (BATTERY_DESCRIPTION,),
|
||||||
"Meter": (
|
"Meter": (
|
||||||
TEMPERATURE_DESCRIPTION,
|
TEMPERATURE_DESCRIPTION,
|
||||||
HUMIDITY_DESCRIPTION,
|
HUMIDITY_DESCRIPTION,
|
||||||
@ -133,6 +134,8 @@ SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = {
|
|||||||
BATTERY_DESCRIPTION,
|
BATTERY_DESCRIPTION,
|
||||||
CO2_DESCRIPTION,
|
CO2_DESCRIPTION,
|
||||||
),
|
),
|
||||||
|
"Smart Lock Pro": (BATTERY_DESCRIPTION,),
|
||||||
|
"Smart Lock": (BATTERY_DESCRIPTION,),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user