diff --git a/tests/components/homekit_controller/fixtures/lutron_caseta_bridge.json b/tests/components/homekit_controller/fixtures/lutron_caseta_bridge.json new file mode 100644 index 00000000000..40366ad32c6 --- /dev/null +++ b/tests/components/homekit_controller/fixtures/lutron_caseta_bridge.json @@ -0,0 +1,178 @@ +[ + { + "aid": 1, + "services": [ + { + "iid": 1, + "type": "0000003E-0000-1000-8000-0026BB765291", + "characteristics": [ + { + "type": "00000014-0000-1000-8000-0026BB765291", + "iid": 85899345921, + "perms": ["pw"], + "format": "bool", + "description": "Identify" + }, + { + "type": "00000020-0000-1000-8000-0026BB765291", + "iid": 137438953473, + "perms": ["pr"], + "format": "string", + "value": "Lutron Electronics Co., Inc", + "description": "Manufacturer", + "maxLen": 64 + }, + { + "type": "00000021-0000-1000-8000-0026BB765291", + "iid": 141733920769, + "perms": ["pr"], + "format": "string", + "value": "L-BDG2-WH", + "description": "Model", + "maxLen": 64 + }, + { + "type": "00000023-0000-1000-8000-0026BB765291", + "iid": 150323855361, + "perms": ["pr"], + "format": "string", + "value": "Smart Bridge 2", + "description": "Name", + "maxLen": 64 + }, + { + "type": "00000030-0000-1000-8000-0026BB765291", + "iid": 206158430209, + "perms": ["pr"], + "format": "string", + "value": "12344331", + "description": "Serial Number", + "maxLen": 64 + }, + { + "type": "00000052-0000-1000-8000-0026BB765291", + "iid": 352187318273, + "perms": ["pr"], + "format": "string", + "value": "08.08", + "description": "Firmware Revision", + "maxLen": 64 + } + ] + }, + { + "iid": 2, + "type": "000000A2-0000-1000-8000-0026BB765291", + "characteristics": [ + { + "type": "00000037-0000-1000-8000-0026BB765291", + "iid": 236223201282, + "perms": ["pr"], + "format": "string", + "value": "1.1.0", + "description": "Version", + "maxLen": 64 + } + ] + } + ] + }, + { + "aid": 21474836482, + "services": [ + { + "iid": 1, + "type": "0000003E-0000-1000-8000-0026BB765291", + "characteristics": [ + { + "type": "00000014-0000-1000-8000-0026BB765291", + "iid": 85899345921, + "perms": ["pw"], + "format": "bool", + "description": "Identify" + }, + { + "type": "00000020-0000-1000-8000-0026BB765291", + "iid": 137438953473, + "perms": ["pr"], + "format": "string", + "value": "Lutron Electronics Co., Inc", + "description": "Manufacturer", + "maxLen": 64 + }, + { + "type": "00000021-0000-1000-8000-0026BB765291", + "iid": 141733920769, + "perms": ["pr"], + "format": "string", + "value": "PD-FSQN-XX", + "description": "Model", + "maxLen": 64 + }, + { + "type": "00000023-0000-1000-8000-0026BB765291", + "iid": 150323855361, + "perms": ["pr"], + "format": "string", + "value": "Cas\u00e9ta\u00ae Wireless Fan Speed Control", + "description": "Name", + "maxLen": 64 + }, + { + "type": "00000030-0000-1000-8000-0026BB765291", + "iid": 206158430209, + "perms": ["pr"], + "format": "string", + "value": "39024290", + "description": "Serial Number", + "maxLen": 64 + }, + { + "type": "00000052-0000-1000-8000-0026BB765291", + "iid": 352187318273, + "perms": ["pr"], + "format": "string", + "value": "001.005", + "description": "Firmware Revision", + "maxLen": 64 + } + ] + }, + { + "iid": 2, + "type": "00000040-0000-1000-8000-0026BB765291", + "characteristics": [ + { + "type": "00000029-0000-1000-8000-0026BB765291", + "iid": 176093659138, + "perms": ["pr", "pw", "ev"], + "format": "float", + "value": 0, + "description": "Rotation Speed", + "unit": "percentage", + "minValue": 0, + "maxValue": 100, + "minStep": 25 + }, + { + "type": "00000023-0000-1000-8000-0026BB765291", + "iid": 150323855362, + "perms": ["pr"], + "format": "string", + "value": "Cas\u00e9ta\u00ae Wireless Fan Speed Control", + "description": "Name", + "maxLen": 64 + }, + { + "type": "00000025-0000-1000-8000-0026BB765291", + "iid": 158913789954, + "perms": ["pr", "pw", "ev"], + "format": "bool", + "value": false, + "description": "On" + } + ] + } + ] + } +] diff --git a/tests/components/homekit_controller/specific_devices/test_lutron_caseta_bridge.py b/tests/components/homekit_controller/specific_devices/test_lutron_caseta_bridge.py new file mode 100644 index 00000000000..8961eb414fa --- /dev/null +++ b/tests/components/homekit_controller/specific_devices/test_lutron_caseta_bridge.py @@ -0,0 +1,55 @@ +"""Tests for handling accessories on a Lutron Caseta bridge via HomeKit.""" + +from homeassistant.const import STATE_OFF + +from tests.components.homekit_controller.common import ( + HUB_TEST_ACCESSORY_ID, + DeviceTestInfo, + EntityTestInfo, + assert_devices_and_entities_created, + setup_accessories_from_file, + setup_test_accessories, +) + + +async def test_lutron_caseta_bridge_setup(hass): + """Test that a Lutron Caseta bridge can be correctly setup in HA via HomeKit.""" + accessories = await setup_accessories_from_file(hass, "lutron_caseta_bridge.json") + await setup_test_accessories(hass, accessories) + + await assert_devices_and_entities_created( + hass, + DeviceTestInfo( + unique_id=HUB_TEST_ACCESSORY_ID, + name="Smart Bridge 2", + model="L-BDG2-WH", + manufacturer="Lutron Electronics Co., Inc", + sw_version="08.08", + hw_version="", + serial_number="12344331", + devices=[ + DeviceTestInfo( + name="Cas\u00e9ta\u00ae Wireless Fan Speed Control", + model="PD-FSQN-XX", + manufacturer="Lutron Electronics Co., Inc", + sw_version="001.005", + hw_version="", + serial_number="39024290", + unique_id="00:00:00:00:00:00:aid:21474836482", + devices=[], + entities=[ + EntityTestInfo( + entity_id="fan.caseta_r_wireless_fan_speed_control", + friendly_name="Caséta® Wireless Fan Speed Control", + unique_id="homekit-39024290-2", + unit_of_measurement=None, + supported_features=1, + state=STATE_OFF, + capabilities={"preset_modes": None}, + ) + ], + ), + ], + entities=[], + ), + )