From 2a823b30436b47ea5f6164dd6f0e46331d662494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20He=C3=9F?= <65811753+blockiyt@users.noreply.github.com> Date: Sat, 2 Nov 2024 18:09:38 +0100 Subject: [PATCH 1/3] fixed typing and documentation for rename light function --- docs/lights.md | 4 ++-- src/api/Lights.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/lights.md b/docs/lights.md index 8e32c86..f1486a4 100644 --- a/docs/lights.md +++ b/docs/lights.md @@ -283,10 +283,10 @@ A complete code sample for this function is available [here](../examples/v3/ligh ## renameLight() -The `renameLight(id, name)` function allows you to rename the light identified by the `id` to the specified `name` value. +The `renameLight(light)` function allows you to rename the light identified by its object. ```js -api.lights.renameLight(id, 'my_new_name') +api.lights.renameLight(light) .then(result => { console.log(`Successfully reanmed light? ${result}`); }); diff --git a/src/api/Lights.ts b/src/api/Lights.ts index 42eb7d9..18ed21f 100644 --- a/src/api/Lights.ts +++ b/src/api/Lights.ts @@ -98,7 +98,7 @@ export class Lights extends ApiDefinition { /** * Renames a Light on the Bridge to the specified name in the Light instance. */ - renameLight(light: Lights): Promise { + renameLight(light: LightsType): Promise { return this.execute(lightsApi.setLightAttributes, {id: light, light: light}); } From ee5a57cc24d73048d1d090dfb879f9ef760814a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20He=C3=9F?= <65811753+blockiyt@users.noreply.github.com> Date: Sat, 2 Nov 2024 18:28:30 +0100 Subject: [PATCH 2/3] fixed missing id in renameLight function --- src/api/Lights.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/Lights.ts b/src/api/Lights.ts index 18ed21f..f70f61e 100644 --- a/src/api/Lights.ts +++ b/src/api/Lights.ts @@ -99,7 +99,7 @@ export class Lights extends ApiDefinition { * Renames a Light on the Bridge to the specified name in the Light instance. */ renameLight(light: LightsType): Promise { - return this.execute(lightsApi.setLightAttributes, {id: light, light: light}); + return this.execute(lightsApi.setLightAttributes, {id: light.id, light: light}); } // /** From 84c12d15e5474834188bd8f925d23a7375009b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20He=C3=9F?= <65811753+blockiyt@users.noreply.github.com> Date: Sat, 2 Nov 2024 19:17:22 +0100 Subject: [PATCH 3/3] Revert "fixed missing id in renameLight function" This reverts commit ee5a57cc24d73048d1d090dfb879f9ef760814a8. --- src/api/Lights.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/Lights.ts b/src/api/Lights.ts index f70f61e..18ed21f 100644 --- a/src/api/Lights.ts +++ b/src/api/Lights.ts @@ -99,7 +99,7 @@ export class Lights extends ApiDefinition { * Renames a Light on the Bridge to the specified name in the Light instance. */ renameLight(light: LightsType): Promise { - return this.execute(lightsApi.setLightAttributes, {id: light.id, light: light}); + return this.execute(lightsApi.setLightAttributes, {id: light, light: light}); } // /**