fixed a bug where the effects were not updated

This commit is contained in:
jangxx 2019-01-29 22:51:58 +01:00
parent 913580aec2
commit c56caf3de8
2 changed files with 14 additions and 3 deletions

View File

@ -184,8 +184,19 @@ class HCMagicHome extends HCColorLamp {
//console.log(status); //console.log(status);
futureState.on = status.on; futureState.on = status.on;
let effect = (status.mode != 'color' && status.mode != 'warm_white' && status.mode != 'special') ? status.mode : 'none';
if(effect != 'none') {
let speed = (status.speed > 80) ? 'fast' : (status.speed > 30) ? 'medium' : 'slow';
futureState.effect = speed + '-' + effect;
} else {
futureState.effect = 'none';
}
if (futureState.effect == 'none') { // only update color when no effects are playing
futureState.brightness = extractBrightness(status.color); futureState.brightness = extractBrightness(status.color);
futureState.color = RGB_to_HSL(removeBrightness(status.color)); futureState.color = RGB_to_HSL(removeBrightness(status.color));
}
if (currentState.hash != futureState.hash) { if (currentState.hash != futureState.hash) {
// the state of the controller has changed externally // the state of the controller has changed externally

View File

@ -1,6 +1,6 @@
{ {
"name": "hc-magichome", "name": "hc-magichome",
"version": "1.0.0", "version": "1.0.1",
"description": "Magic Home Plugin for Homecontrol", "description": "Magic Home Plugin for Homecontrol",
"main": "HCMagicHome.js", "main": "HCMagicHome.js",
"scripts": { "scripts": {