Skip to content

Commit

Permalink
(v0.8.4) fix activateScene when the scene is already selected
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Feb 23, 2018
1 parent 3f68ae6 commit 2dcad14
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ A DeviceInfo object contains general information about a device. It has the foll

## Changelog

#### 0.8.4 (2018-02-23)
* (AlCalzone) Fixed `Group.activateScene` when the scene was already selected

#### 0.8.3 (2018-02-22)
* (AlCalzone) Removed the recently-added payload merging because it did more harm than good
* (AlCalzone) Fixed `Group.activateScene` when the lights are turned off
Expand Down
6 changes: 5 additions & 1 deletion build/lib/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ class Group extends ipsoDevice_1.IPSODevice {
activateScene(sceneOrId) {
this.ensureLink();
const id = (sceneOrId instanceof scene_1.Scene) ? sceneOrId.instanceId : sceneOrId;
return this.client.operateGroup(this, {
// we need to make sure the scene ID always gets sent, so we cheat a bit
const reference = this.clone();
reference.sceneId = Number.NaN;
reference.onOff = false;
return this.client.operateGroup(reference, {
sceneId: id,
onOff: true,
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-tradfri-client",
"version": "0.8.3",
"version": "0.8.4",
"description": "Library to talk to IKEA Trådfri Gateways without external binaries",
"keywords": [
"coap",
Expand Down
6 changes: 5 additions & 1 deletion src/lib/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ export class Group extends IPSODevice {
public activateScene(sceneOrId: Scene | number): Promise<boolean> {
this.ensureLink();
const id: number = (sceneOrId instanceof Scene) ? sceneOrId.instanceId : sceneOrId;
return this.client.operateGroup(this, {
// we need to make sure the scene ID always gets sent, so we cheat a bit
const reference = this.clone();
reference.sceneId = Number.NaN;
reference.onOff = false;
return this.client.operateGroup(reference, {
sceneId: id,
onOff: true, // this has to be true when changing a scene
});
Expand Down

0 comments on commit 2dcad14

Please sign in to comment.