Skip to content

Latest commit

 

History

History
183 lines (131 loc) · 4.22 KB

File metadata and controls

183 lines (131 loc) · 4.22 KB

GroupedLightService

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

Methods Description
getGroupedLights List all grouped lights
getGroupedLight Get details of a single grouped light from its given {groupedLightId}.
updateGroupedLight Update a single grouped light from its given {groupedLightId}.

getGroupedLights

List all grouped lights

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

Return Type

GetGroupedLightsOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

(async () => {
  const openHue = new OpenHue({
    apiKey: 'YOUR_API_KEY',
  });

  const { data } = await openHue.groupedLight.getGroupedLights();

  console.log(data);
})();

getGroupedLight

Get details of a single grouped light from its given {groupedLightId}.

  • HTTP Method: GET
  • Endpoint: /clip/v2/resource/grouped_light/{groupedLightId}

Parameters

Name Type Required Description
groupedLightId string ID of the grouped light

Return Type

GetGroupedLightOkResponse

Example Usage Code Snippet

import { OpenHue } from 'open-hue';

(async () => {
  const openHue = new OpenHue({
    apiKey: 'YOUR_API_KEY',
  });

  const { data } = await openHue.groupedLight.getGroupedLight('groupedLightId');

  console.log(data);
})();

updateGroupedLight

Update a single grouped light from its given {groupedLightId}.

  • HTTP Method: PUT
  • Endpoint: /clip/v2/resource/grouped_light/{groupedLightId}

Parameters

Name Type Required Description
body GroupedLightPut The request body.
groupedLightId string ID of the light

Return Type

UpdateGroupedLightOkResponse

Example Usage Code Snippet

import {
  Alert,
  Color,
  ColorTemperature,
  ColorTemperatureDelta,
  Dimming,
  DimmingDelta,
  Dynamics2,
  GroupedLightPut,
  On,
  OpenHue,
  Signaling,
} from 'open-hue';

(async () => {
  const openHue = new OpenHue({
    apiKey: 'YOUR_API_KEY',
  });

  const groupedLightPutType = GroupedLightPutType.grouped_light;

  const on: On = {
    on1: true,
  };

  const dimming: Dimming = {
    brightness: 11.42,
  };

  const dimmingDeltaAction = DimmingDeltaAction.up;

  const dimmingDelta: DimmingDelta = {
    action: dimmingDeltaAction,
    brightnessDelta: 56.69,
  };

  const colorTemperature: ColorTemperature = {
    mirek: 360,
  };

  const colorTemperatureDeltaAction = ColorTemperatureDeltaAction.up;

  const colorTemperatureDelta: ColorTemperatureDelta = {
    action: colorTemperatureDeltaAction,
    mirekDelta: 121,
  };

  const gamutPosition: GamutPosition = {
    x: 123,
    y: 0.47,
  };

  const color: Color = {
    xy: gamutPosition,
  };

  const alert: Alert = {
    action: 'breathe',
  };

  const signal = Signal.no_signal;

  const signaling: Signaling = {
    signal: signal,
    duration: 53090288,
    color: [color],
  };

  const dynamics2: Dynamics2 = {
    duration: 7,
  };

  const input: GroupedLightPut = {
    type_: groupedLightPutType,
    on: on,
    dimming: dimming,
    dimmingDelta: dimmingDelta,
    colorTemperature: colorTemperature,
    colorTemperatureDelta: colorTemperatureDelta,
    color: color,
    alert: alert,
    signaling: signaling,
    dynamics: dynamics2,
  };

  const { data } = await openHue.groupedLight.updateGroupedLight('groupedLightId', input);

  console.log(data);
})();