Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
try to show current value of a new light in SD+
Browse files Browse the repository at this point in the history
  • Loading branch information
tiptronic committed Jan 5, 2023
1 parent e2e10e8 commit c66f8e4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ In the [Release](./Release) folder, you can find the file `com.elgato.philips-hu
The [Sources](./Sources) folder contains the source code of the plugin.

# Changes
## 1.6.4
- fixed/improved support for temperature actions
- PI now lets you only select lights for a temperature action if they support color temperature

## 1.6.3
- updated CSS to the latest versions of our SDK-libs
- added an option to the PI to allow larger steps if you rotate dials (1,2,3,4,5,10).
Expand Down
11 changes: 11 additions & 0 deletions Sources/com.elgato.philips-hue.sdPlugin/plugin/js/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ function Action(inContext, inSettings, jsn) {
};

this.updateDisplay = (lightOrGroup, property) => {
if(!lightOrGroup) {
const curLightOrGroup = this.getCurrentLightOrGroup();
if(curLightOrGroup) {
lightOrGroup = curLightOrGroup.objCache;
this.savedValue = -1; // force update
}
console.assert(lightOrGroup, 'no light or group', curLightOrGroup);
if(!lightOrGroup) return;
};
if(this.isInMultiAction || !this.isEncoder) return;
const powerHue = property == 'power' ? !lightOrGroup?.power : lightOrGroup?.power;
let actionValue = lightOrGroup?.[this.property];
Expand All @@ -98,6 +107,8 @@ function Action(inContext, inSettings, jsn) {
let value;
if(this.property == 'temperature') {
const ct = lightOrGroup.originalValue?.capabilities?.control?.ct;
console.assert(ct, 'no ct in capabilities', lightOrGroup);
if(!ct) return;
value = parseInt(Utils.percent(lightOrGroup.temperature, ct.min, ct.max));
} else {
value = parseInt(actionValue / 2.54);
Expand Down
7 changes: 7 additions & 0 deletions Sources/com.elgato.philips-hue.sdPlugin/plugin/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ function connectElgatoStreamDeckSocket(inPort, inPluginUUID, inRegisterEvent, in
actions[context].onKeyUp(context);
}
}
} else if (piEvent === 'lightsChanged') {
// console.log("lightsChanged", action, context, jsonPayload);
if (context in actions) {
if(actions[context].updateDisplay) {
actions[context].updateDisplay();
};
}
}
}
};
Expand Down

0 comments on commit c66f8e4

Please sign in to comment.