LightService
A list of all methods in the LightService
service. Click on the method name to view detailed information about that method.
Methods | Description |
---|---|
get_lights | List all available lights. |
get_light | Get details of a single light from its given {lightId} . |
update_light | Update a single light from its given {lightId} . |
get_lights
List all available lights.
- HTTP Method:
GET
- Endpoint:
/clip/v2/resource/light
Return Type
GetLightsOkResponse
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.light.get_lights()
print(result)
get_light
Get details of a single light from its given {lightId}
.
- HTTP Method:
GET
- Endpoint:
/clip/v2/resource/light/{lightId}
Parameters
Name | Type | Required | Description |
---|---|---|---|
light_id | str | ✅ | ID of the light |
Return Type
GetLightOkResponse
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.light.get_light(light_id="lightId")
print(result)
update_light
Update a single light from its given {lightId}
.
- HTTP Method:
PUT
- Endpoint:
/clip/v2/resource/light/{lightId}
Parameters
Name | Type | Required | Description |
---|---|---|---|
request_body | LightPut | ❌ | The request body. |
light_id | str | ✅ | ID of the light |
Return Type
UpdateLightOkResponse
Example Usage Code Snippet
from open_hue import OpenHue, Environment
from open_hue.models import LightPut
sdk = OpenHue(
api_key="YOUR_API_KEY",
api_key_header="YOUR_API_KEY_HEADER",
base_url=Environment.DEFAULT.value
)
request_body = LightPut(
type_="type",
on={
"on": False
},
dimming={
"brightness": 11.42
},
dimming_delta={
"action": "up",
"brightness_delta": 56.69
},
color_temperature={
"mirek": 360
},
color_temperature_delta={
"action": "up",
"mirek_delta": 121
},
color={
"xy": {
"x": 0,
"y": 0.47
}
},
dynamics={
"duration": 8,
"speed": 0
},
alert={
"action": "breathe"
},
signaling={
"signal": "no_signal",
"duration": 53090288,
"color": [
{
"xy": {
"x": 0,
"y": 0.47
}
}
]
},
mode="normal",
gradient={
"points": [
{
"xy": {
"x": 0,
"y": 0.47
}
}
],
"mode": "interpolated_palette"
},
effects={
"effect": "prism"
},
timed_effects={
"effect": "sunrise",
"duration": 10
},
powerup={
"preset": "safety",
"configured": True,
"on": {
"mode": "on",
"on": {
"on": False
}
},
"dimming": {
"mode": "dimming",
"dimming": 98.85,
"color": {
"mode": "color_temperature",
"color_temperature": {
"mirek": 267,
"color": {
"xy": {
"x": 0,
"y": 0.47
}
}
}
}
}
}
)
result = sdk.light.update_light(
request_body=request_body,
light_id="lightId"
)
print(result)
Build Your Own SDKs with liblab
Build developer friendly SDKs in minutes from your APIs