Add support for doorbells and chimes (#1435)

Add support for `smart` chimes and `smartcam` doorbells that are not hub child devices.
Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
This commit is contained in:
steveredden
2025-01-23 03:22:41 -06:00
committed by GitHub
parent acc0e9a80a
commit 54bb53899e
13 changed files with 75 additions and 42 deletions

View File

@@ -131,6 +131,7 @@ SENSORS_SMART = {
"S200D",
"S210",
"S220",
"D100C", # needs a home category?
}
THERMOSTATS_SMART = {"KE100"}
@@ -345,6 +346,16 @@ hub_smartcam = parametrize(
device_type_filter=[DeviceType.Hub],
protocol_filter={"SMARTCAM"},
)
doobell_smartcam = parametrize(
"doorbell smartcam",
device_type_filter=[DeviceType.Doorbell],
protocol_filter={"SMARTCAM", "SMARTCAM.CHILD"},
)
chime_smart = parametrize(
"chime smart",
device_type_filter=[DeviceType.Chime],
protocol_filter={"SMART"},
)
vacuum = parametrize("vacuums", device_type_filter=[DeviceType.Vacuum])
@@ -362,7 +373,9 @@ def check_categories():
+ hubs_smart.args[1]
+ sensors_smart.args[1]
+ thermostats_smart.args[1]
+ chime_smart.args[1]
+ camera_smartcam.args[1]
+ doobell_smartcam.args[1]
+ hub_smartcam.args[1]
+ vacuum.args[1]
)

View File

@@ -121,19 +121,9 @@ async def test_device_class_repr(device_class_name_obj):
klass = device_class_name_obj[1]
if issubclass(klass, SmartChildDevice | SmartCamChild):
parent = SmartDevice(host, config=config)
smartcam_required = {
"device_model": "foo",
"device_type": "SMART.TAPODOORBELL",
"alias": "Foo",
"sw_ver": "1.1",
"hw_ver": "1.0",
"mac": "1.2.3.4",
"hwId": "hw_id",
"oem_id": "oem_id",
}
dev = klass(
parent,
{"dummy": "info", "device_id": "dummy", **smartcam_required},
{"dummy": "info", "device_id": "dummy"},
{
"component_list": [{"id": "device", "ver_code": 1}],
"app_component_list": [{"name": "device", "version": 1}],
@@ -153,8 +143,8 @@ async def test_device_class_repr(device_class_name_obj):
IotCamera: DeviceType.Camera,
SmartChildDevice: DeviceType.Unknown,
SmartDevice: DeviceType.Unknown,
SmartCamDevice: DeviceType.Camera,
SmartCamChild: DeviceType.Camera,
SmartCamDevice: DeviceType.Unknown,
SmartCamChild: DeviceType.Unknown,
}
type_ = CLASS_TO_DEFAULT_TYPE[klass]
child_repr = "<DeviceType.Unknown(child) of <DeviceType.Unknown at 127.0.0.2 - update() needed>>"

View File

@@ -245,6 +245,12 @@ ET = DeviceEncryptionType
SslAesTransport,
id="smartcam-hub",
),
pytest.param(
CP(DF.SmartTapoDoorbell, ET.Aes, https=True),
SmartCamProtocol,
SslAesTransport,
id="smartcam-doorbell",
),
pytest.param(
CP(DF.IotIpCamera, ET.Aes, https=True),
IotProtocol,
@@ -281,6 +287,12 @@ ET = DeviceEncryptionType
KlapTransportV2,
id="smart-klap",
),
pytest.param(
CP(DF.SmartTapoChime, ET.Klap, https=False),
SmartProtocol,
KlapTransportV2,
id="smart-chime",
),
],
)
async def test_get_protocol(