Skip to main content

OpenHue TypeScript SDK 1.0.0

Welcome to the OpenHue SDK documentation. This guide will help you get started with integrating and using the OpenHue SDK in your project.

Versions

  • API version: v2
  • SDK version: 1.0.0

About the API

See openhue/openhue-api

Table of Contents

Setup & Configuration

Supported Language Versions

This SDK is compatible with the following versions: TypeScript >= 4.8.4

Installation

To get started with the SDK, we recommend installing using npm:

npm install open-hue

Authentication

API Key Authentication

The OpenHue API uses API keys as a form of authentication. An API key is a unique identifier used to authenticate a user, developer, or a program that is calling the API.

Setting the API key

When you initialize the SDK, you can set the API key as follows:

const sdk = new OpenHue({ apiKey: 'YOUR_API_KEY' });

If you need to set or update the API key after initializing the SDK, you can use:

const sdk = new OpenHue();
sdk.apiKey = 'YOUR_API_KEY';

Services

The SDK provides various services to interact with the API.

Below is a list of all available services with links to their detailed documentation:

Models

The SDK includes several models that represent the data structures used in API requests and responses. These models help in organizing and managing the data efficiently.

Below is a list of all available models with links to their detailed documentation:
NameDescription
AuthenticateRequest
Response
GetResourcesOkResponse
GetDevicesOkResponse
GetDeviceOkResponse
DevicePut
UpdateDeviceOkResponse
DeleteDeviceOkResponse
GetDevicePowersOkResponse
GetDevicePowerOkResponse
GetLightsOkResponse
GetLightOkResponse
LightPut
UpdateLightOkResponse
GetLightLevelsOkResponse
GetLightLevelOkResponse
LightLevelPut
UpdateLightLevelOkResponse
GetMotionSensorsOkResponse
GetMotionSensorOkResponse
MotionPut
UpdateMotionSensorOkResponse
GetGroupedLightsOkResponse
GetGroupedLightOkResponse
GroupedLightPut
UpdateGroupedLightOkResponse
GetBridgesOkResponse
GetBridgeOkResponse
BridgePut
UpdateBridgeOkResponse
GetBridgeHomesOkResponse
GetBridgeHomeOkResponse
GetScenesOkResponse
ScenePost
CreateSceneOkResponse
GetSceneOkResponse
ScenePut
UpdateSceneOkResponse
DeleteSceneOkResponse
GetRoomsOkResponse
RoomPut
CreateRoomOkResponse
GetRoomOkResponse
UpdateRoomOkResponse
DeleteRoomOkResponse
GetZonesOkResponse
CreateZoneOkResponse
GetZoneOkResponse
UpdateZoneOkResponse
DeleteZoneOkResponse
GetTemperaturesOkResponse
GetTemperatureOkResponse
TemperaturePut
UpdateTemperatureOkResponse
Success
ResponseError
Error
ResourceGet
ResourceGetTypeType of the supported resources
ResourceIdentifier
RtypeThe type of the referenced resource
DeviceGet
DeviceGetType
ProductData
DeviceGetMetadata
DeviceGetUsertest
ProductArchetypeThe default archetype given by manufacturer. Can be changed by user.
UsertestStatus
DevicePutType
DevicePutMetadata
Identify
DevicePutUsertest
IdentifyActionTriggers a visual identification sequence, current implemented as (which can change in the future): Bridge performs Zigbee LED identification cycles for 5 seconds Lights perform one breathe cycle Sensors perform LED identification cycles for 15 seconds
DevicePowerGet
PowerState
BatteryStateStatus of the power source of a device, only for battery powered devices. - normal – battery level is sufficient - low – battery level low, some features (e.g. software update) might stop working, please change battery soon - critical – battery level critical, device can fail any moment
LightGet
LightGetMetadataDeprecated, use metadata on device level
On
LightGetDimming
LightGetColorTemperature
LightGetColor
LightGetDynamics
LightGetSignalingFeature containing signaling properties.
LightGetMode
LightGetGradient
LightGetEffectsBasic feature containing effect properties.
LightGetTimedEffectsBasic feature containing timed effect properties.
LightGetPowerupFeature containing properties to configure powerup behaviour of a lightsource.
LightArchetypeLight archetype
MirekSchema
GamutPositionCIE XY gamut position
GamutColor gamut of color bulb. Some bulbs do not properly return the Gamut information. In this case this is not present.
GamutTypeThe gammut types supported by hue – A Gamut of early Philips color-only products – B Limited gamut of first Hue color products – C Richer color gamut of Hue white and color ambiance products – other Color gamut of non-hue products with non-hue gamuts resp w/o gamut
SupportedDynamicStatusCurrent status of the lamp with dynamics.
SupportedSignalsIndicates which signal is currently active.
Color
SupportedGradientModeMode in which the points are currently being deployed. If not provided during PUT/POST it will be defaulted to interpolated_palette
SupportedEffects
SupportedTimedEffectsCurrent status values the light is in regarding timed effects
PowerupPreset1When setting the custom preset the additional properties can be set. For all other presets, no other properties can be included.
PowerupOn1
PowerupDimming1
OnMode1State to activate after powerup. On will use the value specified in the “on” property. When setting mode “on”, the on property must be included. Toggle will alternate between on and off on each subsequent power toggle. Previous will return to the state it was in before powering off.
DimmingMode1Dimming will set the brightness to the specified value after power up. When setting mode “dimming”, the dimming property must be included. Previous will set brightness to the state it was in before powering off.
Dimming
DimmingColor1
ColorMode1State to activate after powerup. Availability of “color_temperature” and “color” modes depend on the capabilities of the lamp. Colortemperature will set the colortemperature to the specified value after power up. When setting color_temperature, the color_temperature property must be included Color will set the color tot he specified value after power up. When setting color mode, the color property must be included Previous will set color to the state it was in before powering off.
ColorColorTemperature1
DimmingDelta
ColorTemperature
ColorTemperatureDelta
Dynamics
AlertJoined alert control
SignalingFeature containing basic signaling properties.
LightPutMode
GradientBasic feature containing gradient properties.
EffectsBasic feature containing effect properties.
LightPutTimedEffectsBasic feature containing timed effect properties.
PowerupFeature containing properties to configure powerup behaviour of a lightsource.
DimmingDeltaAction
ColorTemperatureDeltaAction
Signal- no_signal: No signal is active. Write “no_signal” to stop active signal. - on_off: Toggles between max brightness and Off in fixed color. - on_off_color: Toggles between off and max brightness with color provided. - alternating: Alternates between 2 provided colors.
PowerupPreset2When setting the custom preset the additional properties can be set. For all other presets, no other properties can be included.
PowerupOn2
PowerupDimming2
OnMode2State to activate after powerup. On will use the value specified in the “on” property. When setting mode “on”, the on property must be included. Toggle will alternate between on and off on each subsequent power toggle. Previous will return to the state it was in before powering off.
DimmingMode2Dimming will set the brightness to the specified value after power up. When setting mode “dimming”, the dimming property must be included. Previous will set brightness to the state it was in before powering off.
DimmingColor2
ColorMode2State to activate after powerup. Availability of “color_temperature” and “color” modes depend on the capabilities of the lamp. Colortemperature will set the colortemperature to the specified value after power up. When setting color_temperature, the color_temperature property must be included Color will set the color tot he specified value after power up. When setting color mode, the color property must be included Previous will set color to the state it was in before powering off.
ColorColorTemperature2
LightLevelGet
Light
LightLevelReport
MotionGet
Motion
MotionGetSensitivity
MotionReport
SensitivityStatus
MotionPutSensitivity
GroupedLightGet
GroupedLightGetAlertJoined alert control
GroupedLightGetSignalingFeature containing basic signaling properties.
GroupedLightPutTypeType of the supported resources (always grouped_light here)
Dynamics2
BridgeGet
BridgeGetType
TimeZone
BridgePutType
BridgeHomeGet
BridgeHomeGetType
SceneGet
SceneGetType
ActionGet
SceneMetadata
ScenePaletteGroup of colors that describe the palette of colors to be used when playing dynamics
SceneGetStatus
ActionGetActionThe action to be executed on recall
ActionEffects1Basic feature containing effect properties.
ColorPaletteGet
ColorTemperaturePalettePost
ScenePaletteEffects
ColorTemperaturePalettePostColorTemperature
Active
ActionPost
ScenePostType
ActionPostActionThe action to be executed on recall
ActionColorTemperature
ActionEffects2Basic feature containing effect properties.
ScenePutType
SceneRecall
SceneRecallActionWhen writing active, the actions in the scene are executed on the target. dynamic_palette starts dynamic scene with colors in the Palette object.
RoomGet
RoomGetMetadataconfiguration object for a room
RoomArchetypePossible archetypes of a room
RoomPutMetadataconfiguration object for a room
TemperatureGet
Temperature
TemperatureReport
TemperaturePutTypeType of the supported resources (always temperature here)

License

This SDK is licensed under the MIT License.

See the LICENSE file for more details.

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →