@@ -470,6 +470,50 @@ def test_Xiaomi_CGDK2():
470470 )
471471
472472
473+ def test_Xiaomi_CGDK3 ():
474+ """Test Xiaomi parser for CGDK3."""
475+ data_string = b"HXYO\xef To\x0e tPr\x93 !\x01 \x00 8\xd7 C3"
476+ bindkey = "872ea1bb02ba9713e885cb054c537368"
477+
478+ advertisement = bytes_to_service_info (data_string , address = "58:2D:34:87:94:0C" )
479+
480+ device = XiaomiBluetoothDeviceData (bindkey = bytes .fromhex (bindkey ))
481+ assert device .supported (advertisement )
482+ assert device .bindkey_verified
483+ assert device .update (advertisement ) == SensorUpdate (
484+ title = "Temperature/Humidity Sensor 940C (CGDK3)" ,
485+ devices = {
486+ None : SensorDeviceInfo (
487+ name = "Temperature/Humidity Sensor 940C" ,
488+ manufacturer = "Xiaomi" ,
489+ model = "CGDK3" ,
490+ hw_version = None ,
491+ sw_version = "Xiaomi (MiBeacon V5 encrypted)" ,
492+ )
493+ },
494+ entity_descriptions = {
495+ KEY_TEMPERATURE : SensorDescription (
496+ device_key = KEY_TEMPERATURE ,
497+ device_class = DeviceClass .TEMPERATURE ,
498+ native_unit_of_measurement = "°C" ,
499+ ),
500+ KEY_SIGNAL_STRENGTH : SensorDescription (
501+ device_key = KEY_SIGNAL_STRENGTH ,
502+ device_class = DeviceClass .SIGNAL_STRENGTH ,
503+ native_unit_of_measurement = "dBm" ,
504+ ),
505+ },
506+ entity_values = {
507+ KEY_TEMPERATURE : SensorValue (
508+ name = "Temperature" , device_key = KEY_TEMPERATURE , native_value = 23.8
509+ ),
510+ KEY_SIGNAL_STRENGTH : SensorValue (
511+ name = "Signal Strength" , device_key = KEY_SIGNAL_STRENGTH , native_value = - 60
512+ ),
513+ },
514+ )
515+
516+
473517def test_Xiaomi_LYWSD02 ():
474518 """Test Xiaomi parser for LYWSD02."""
475519
0 commit comments