diff --git a/src/hue-interfaces.ts b/src/hue-interfaces.ts index 03cd564..2d9f587 100644 --- a/src/hue-interfaces.ts +++ b/src/hue-interfaces.ts @@ -383,6 +383,7 @@ export namespace States { } export interface Lamp { + lampIndex: number; state: States.LampState; type: string; name: string; diff --git a/src/hue-node.ts b/src/hue-node.ts index 008b7ce..6618a93 100644 --- a/src/hue-node.ts +++ b/src/hue-node.ts @@ -585,7 +585,7 @@ export class Hue extends HueBridge { public async getLamps(): Promise { const url = this.buildLampCompositeURL(); const { data } = await this.get(url); - return Object.keys(data).map(k => data[k]); + return Object.keys(data).map(k => ({...data[k], lampIndex: parseInt(k)})); } /** diff --git a/src/hue-test-constants.ts b/src/hue-test-constants.ts index 864edf9..35deca2 100644 --- a/src/hue-test-constants.ts +++ b/src/hue-test-constants.ts @@ -47,6 +47,7 @@ export const no_brightness: any = 1; export const lamp_response: any = { '1': { + lampIndex: 1, state: { on: true, bri: 144, @@ -75,6 +76,7 @@ export const lamp_response: any = { } }, '2': { + lampIndex: 2, state: { on: false, bri: 0,