Skip to main content

DeviceService

A list of all methods in the DeviceService service. Click on the method name to view detailed information about that method.

MethodsDescription
get_devicesList all available devices
get_deviceGet details of a single device from its given {deviceId}.
update_deviceUpdate a single device from its given {deviceId}.
delete_deviceDelete a single Device from its given {deviceId}. The bridge device cannot be deleted.

get_devices

List all available devices

  • HTTP Method: GET
  • Endpoint: /clip/v2/resource/device

Return Type

GetDevicesOkResponse

Example Usage Code Snippet

from open_hue import OpenHue, Environment

sdk = OpenHue(
api_key="YOUR_API_KEY",
api_key_header="YOUR_API_KEY_HEADER",
base_url=Environment.DEFAULT.value
)

result = sdk.device.get_devices()

print(result)

get_device

Get details of a single device from its given {deviceId}.

  • HTTP Method: GET
  • Endpoint: /clip/v2/resource/device/{deviceId}

Parameters

NameTypeRequiredDescription
device_idstrID of the device

Return Type

GetDeviceOkResponse

Example Usage Code Snippet

from open_hue import OpenHue, Environment

sdk = OpenHue(
api_key="YOUR_API_KEY",
api_key_header="YOUR_API_KEY_HEADER",
base_url=Environment.DEFAULT.value
)

result = sdk.device.get_device(device_id="deviceId")

print(result)

update_device

Update a single device from its given {deviceId}.

  • HTTP Method: PUT
  • Endpoint: /clip/v2/resource/device/{deviceId}

Parameters

NameTypeRequiredDescription
request_bodyDevicePutThe request body.
device_idstrID of the device

Return Type

UpdateDeviceOkResponse

Example Usage Code Snippet

from open_hue import OpenHue, Environment
from open_hue.models import DevicePut

sdk = OpenHue(
api_key="YOUR_API_KEY",
api_key_header="YOUR_API_KEY_HEADER",
base_url=Environment.DEFAULT.value
)

request_body = DevicePut(
type_="device",
metadata={
"name": "ut cupidatat fugiat nisi",
"archetype": "bridge_v2"
},
identify={
"action": "identify"
},
usertest={
"usertest": True
}
)

result = sdk.device.update_device(
request_body=request_body,
device_id="deviceId"
)

print(result)

delete_device

Delete a single Device from its given {deviceId}. The bridge device cannot be deleted.

  • HTTP Method: DELETE
  • Endpoint: /clip/v2/resource/device/{deviceId}

Parameters

NameTypeRequiredDescription
device_idstrID of the Device

Return Type

DeleteDeviceOkResponse

Example Usage Code Snippet

from open_hue import OpenHue, Environment

sdk = OpenHue(
api_key="YOUR_API_KEY",
api_key_header="YOUR_API_KEY_HEADER",
base_url=Environment.DEFAULT.value
)

result = sdk.device.delete_device(device_id="deviceId")

print(result)

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →