Add lock models to switchbot cloud (#147569)

This commit is contained in:
Samuel Xiao 2025-06-28 02:16:21 +08:00 committed by GitHub
parent d874c28dc9
commit 18c1953bc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 4 deletions

View File

@ -153,7 +153,12 @@ async def make_device_data(
)
devices_data.vacuums.append((device, coordinator))
if isinstance(device, Device) and device.device_type.startswith("Smart Lock"):
if isinstance(device, Device) and device.device_type in [
"Smart Lock",
"Smart Lock Lite",
"Smart Lock Pro",
"Smart Lock Ultra",
]:
coordinator = await coordinator_for_device(
hass, entry, api, device, coordinators_by_id
)

View File

@ -48,10 +48,18 @@ BINARY_SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = {
CALIBRATION_DESCRIPTION,
DOOR_OPEN_DESCRIPTION,
),
"Smart Lock Lite": (
CALIBRATION_DESCRIPTION,
DOOR_OPEN_DESCRIPTION,
),
"Smart Lock Pro": (
CALIBRATION_DESCRIPTION,
DOOR_OPEN_DESCRIPTION,
),
"Smart Lock Ultra": (
CALIBRATION_DESCRIPTION,
DOOR_OPEN_DESCRIPTION,
),
}
@ -69,7 +77,6 @@ async def async_setup_entry(
for description in BINARY_SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES[
device.device_type
]
if device.device_type in BINARY_SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES
)

View File

@ -134,8 +134,10 @@ SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = {
BATTERY_DESCRIPTION,
CO2_DESCRIPTION,
),
"Smart Lock Pro": (BATTERY_DESCRIPTION,),
"Smart Lock": (BATTERY_DESCRIPTION,),
"Smart Lock Lite": (BATTERY_DESCRIPTION,),
"Smart Lock Pro": (BATTERY_DESCRIPTION,),
"Smart Lock Ultra": (BATTERY_DESCRIPTION,),
}
@ -151,7 +153,6 @@ async def async_setup_entry(
SwitchBotCloudSensor(data.api, device, coordinator, description)
for device, coordinator in data.devices.sensors
for description in SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES[device.device_type]
if device.device_type in SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES
)