diff --git a/homeassistant/components/smartthings/__init__.py b/homeassistant/components/smartthings/__init__.py index ff03ce5ca67..557d14f8a64 100644 --- a/homeassistant/components/smartthings/__init__.py +++ b/homeassistant/components/smartthings/__init__.py @@ -13,6 +13,7 @@ from aiohttp import ClientResponseError from pysmartthings import ( Attribute, Capability, + Category, ComponentStatus, Device, DeviceEvent, @@ -194,6 +195,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: SmartThingsConfigEntry) } devices = await client.get_devices() for device in devices: + if ( + (main_component := device.components.get(MAIN)) is not None + and main_component.manufacturer_category is Category.BLUETOOTH_TRACKER + ): + device_status[device.device_id] = FullDevice( + device=device, + status={}, + online=True, + ) + continue status = process_status(await client.get_device_status(device.device_id)) online = await client.get_device_health(device.device_id) device_status[device.device_id] = FullDevice( diff --git a/tests/components/smartthings/conftest.py b/tests/components/smartthings/conftest.py index b3a58b17637..253a01b6d5f 100644 --- a/tests/components/smartthings/conftest.py +++ b/tests/components/smartthings/conftest.py @@ -150,6 +150,7 @@ def mock_smartthings() -> Generator[AsyncMock]: "generic_ef00_v1", "bosch_radiator_thermostat_ii", "im_speaker_ai_0001", + "im_smarttag2_ble_uwb", "abl_light_b_001", "tplink_p110", "ikea_kadrilj", diff --git a/tests/components/smartthings/fixtures/device_status/im_smarttag2_ble_uwb.json b/tests/components/smartthings/fixtures/device_status/im_smarttag2_ble_uwb.json new file mode 100644 index 00000000000..e59db7476de --- /dev/null +++ b/tests/components/smartthings/fixtures/device_status/im_smarttag2_ble_uwb.json @@ -0,0 +1,129 @@ +{ + "components": { + "main": { + "tag.e2eEncryption": { + "encryption": { + "value": null + } + }, + "audioVolume": { + "volume": { + "value": null + } + }, + "geofence": { + "enableState": { + "value": null + }, + "geofence": { + "value": null + }, + "name": { + "value": null + } + }, + "tag.updatedInfo": { + "connection": { + "value": "connected", + "timestamp": "2024-02-27T17:44:57.638Z" + } + }, + "tag.factoryReset": {}, + "battery": { + "quantity": { + "value": null + }, + "battery": { + "value": null + }, + "type": { + "value": null + } + }, + "firmwareUpdate": { + "lastUpdateStatusReason": { + "value": null + }, + "availableVersion": { + "value": null + }, + "lastUpdateStatus": { + "value": null + }, + "supportedCommands": { + "value": null + }, + "state": { + "value": null + }, + "updateAvailable": { + "value": false, + "timestamp": "2024-06-25T05:56:22.227Z" + }, + "currentVersion": { + "value": null + }, + "lastUpdateTime": { + "value": null + } + }, + "tag.searchingStatus": { + "searchingStatus": { + "value": null + } + }, + "tag.tagStatus": { + "connectedUserId": { + "value": null + }, + "tagStatus": { + "value": null + }, + "connectedDeviceId": { + "value": null + } + }, + "alarm": { + "alarm": { + "value": null + } + }, + "tag.tagButton": { + "tagButton": { + "value": null + } + }, + "tag.uwbActivation": { + "uwbActivation": { + "value": null + } + }, + "geolocation": { + "method": { + "value": null + }, + "heading": { + "value": null + }, + "latitude": { + "value": null + }, + "accuracy": { + "value": null + }, + "altitudeAccuracy": { + "value": null + }, + "speed": { + "value": null + }, + "longitude": { + "value": null + }, + "lastUpdateTime": { + "value": null + } + } + } + } +} diff --git a/tests/components/smartthings/fixtures/devices/im_smarttag2_ble_uwb.json b/tests/components/smartthings/fixtures/devices/im_smarttag2_ble_uwb.json new file mode 100644 index 00000000000..802b4da1514 --- /dev/null +++ b/tests/components/smartthings/fixtures/devices/im_smarttag2_ble_uwb.json @@ -0,0 +1,184 @@ +{ + "items": [ + { + "deviceId": "83d660e4-b0c8-4881-a674-d9f1730366c1", + "name": "Tag(UWB)", + "label": "SmartTag+ black", + "manufacturerName": "Samsung Electronics", + "presentationId": "IM-SmartTag-BLE-UWB", + "deviceManufacturerCode": "Samsung Electronics", + "locationId": "redacted_locid", + "ownerId": "redacted", + "roomId": "redacted_roomid", + "components": [ + { + "id": "main", + "label": "main", + "capabilities": [ + { + "id": "alarm", + "version": 1 + }, + { + "id": "tag.tagButton", + "version": 1 + }, + { + "id": "audioVolume", + "version": 1 + }, + { + "id": "battery", + "version": 1 + }, + { + "id": "tag.factoryReset", + "version": 1 + }, + { + "id": "tag.e2eEncryption", + "version": 1 + }, + { + "id": "tag.tagStatus", + "version": 1 + }, + { + "id": "geolocation", + "version": 1 + }, + { + "id": "geofence", + "version": 1 + }, + { + "id": "tag.uwbActivation", + "version": 1 + }, + { + "id": "tag.updatedInfo", + "version": 1 + }, + { + "id": "tag.searchingStatus", + "version": 1 + }, + { + "id": "firmwareUpdate", + "version": 1 + } + ], + "categories": [ + { + "name": "BluetoothTracker", + "categoryType": "manufacturer" + } + ] + } + ], + "createTime": "2023-05-25T09:42:59.720Z", + "profile": { + "id": "e443f3e8-a926-3deb-917c-e5c6de3af70f" + }, + "bleD2D": { + "encryptionKey": "ZTbd_04NISrhQODE7_i8JdcG2ZWwqmUfY60taptK7J0=", + "cipher": "AES_128-CBC-PKCS7Padding", + "identifier": "415D4Y16F97F", + "configurationVersion": "2.0", + "configurationUrl": "https://apis.samsungiotcloud.com/v1/miniature/profile/b8e65e7e-6152-4704-b9f5-f16352034237", + "bleDeviceType": "BLE", + "metadata": { + "regionCode": 11, + "privacyIdPoolSize": 2000, + "privacyIdSeed": "AAAAAAAX8IQ=", + "privacyIdInitialVector": "ZfqZKLRGSeCwgNhdqHFRpw==", + "numAllowableConnections": 2, + "firmware": { + "version": "1.03.07", + "specVersion": "0.5.6", + "updateTime": 1685007914000, + "latestFirmware": { + "id": 581, + "version": "1.03.07", + "data": { + "checksum": "50E7", + "size": "586004", + "supportedVersion": "0.5.6" + } + } + }, + "currentServerTime": 1739095473, + "searchingStatus": "stop", + "lastKnownConnection": { + "updated": 1713422813, + "connectedUser": { + "id": "sk3oyvsbkm", + "name": "" + }, + "connectedDevice": { + "id": "4f3faa4c-976c-3bd8-b209-607f3a5a9814", + "name": "" + }, + "d2dStatus": "bleScanned", + "nearby": true, + "onDemand": false + }, + "e2eEncryption": { + "enabled": false + }, + "timer": 1713422675, + "category": { + "id": 0 + }, + "remoteRing": { + "enabled": false + }, + "petWalking": { + "enabled": false + }, + "onboardedBy": { + "saGuid": "sk3oyvsbkm" + }, + "shareable": { + "enabled": false + }, + "agingCounter": { + "status": "VALID", + "updated": 1713422675 + }, + "vendor": { + "mnId": "0AFD", + "setupId": "432", + "modelName": "EI-T7300" + }, + "priorityConnection": { + "lba": false, + "cameraShutter": false + }, + "createTime": 1685007780, + "updateTime": 1713422675, + "fmmSearch": false, + "ooTime": { + "currentOoTime": 8, + "defaultOoTime": 8 + }, + "pidPoolSize": { + "desiredPidPoolSize": 2000, + "currentPidPoolSize": 2000 + }, + "activeMode": { + "mode": 0 + }, + "itemConfig": { + "searchingStatus": "stop" + } + } + }, + "type": "BLE_D2D", + "restrictionTier": 0, + "allowed": [], + "executionContext": "CLOUD" + } + ], + "_links": {} +} diff --git a/tests/components/smartthings/snapshots/test_init.ambr b/tests/components/smartthings/snapshots/test_init.ambr index d70d9a1dcfc..596cc487dd5 100644 --- a/tests/components/smartthings/snapshots/test_init.ambr +++ b/tests/components/smartthings/snapshots/test_init.ambr @@ -1487,6 +1487,39 @@ 'via_device_id': None, }) # --- +# name: test_devices[im_smarttag2_ble_uwb] + DeviceRegistryEntrySnapshot({ + 'area_id': None, + 'config_entries': , + 'config_entries_subentries': , + 'configuration_url': 'https://account.smartthings.com', + 'connections': set({ + }), + 'disabled_by': None, + 'entry_type': None, + 'hw_version': None, + 'id': , + 'identifiers': set({ + tuple( + 'smartthings', + '83d660e4-b0c8-4881-a674-d9f1730366c1', + ), + }), + 'is_new': False, + 'labels': set({ + }), + 'manufacturer': None, + 'model': None, + 'model_id': None, + 'name': 'SmartTag+ black', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'suggested_area': None, + 'sw_version': None, + 'via_device_id': None, + }) +# --- # name: test_devices[im_speaker_ai_0001] DeviceRegistryEntrySnapshot({ 'area_id': None,