Skip to content

Commit

Permalink
Merge pull request #194 from brianmay/fix_187
Browse files Browse the repository at this point in the history
Ensure we don't access this.states.color.spectrumHsv if undefined
  • Loading branch information
Caprico85 authored Oct 1, 2021
2 parents c87c8b8 + b750406 commit 6ea481a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions devices/light.js
Original file line number Diff line number Diff line change
Expand Up @@ -1997,9 +1997,14 @@ module.exports = function(RED) {
let brightness = this.is_dimmable ? this.states.brightness : undefined;
let rgb = this.is_rgb ? this.states.color.spectrumRgb: undefined;
let temperature = this.has_temp ? this.states.color.temperatureK : undefined;
let hue = this.is_hsv ? this.states.color.spectrumHsv.hue : undefined;
let saturation = this.is_hsv ? this.states.color.spectrumHsv.saturation : undefined;
let value = this.is_hsv ? this.states.color.spectrumHsv.value : undefined;
let hue = undefined;
let saturation = undefined;
let value = undefined;
if (this.is_hsv && this.states.color.spectrumHsv != null) {
hue = this.states.color.spectrumHsv.hue;
saturation = this.states.color.spectrumHsv.saturation;
value = this.states.color.spectrumHsv.value;
}

let differs = false;

Expand Down

0 comments on commit 6ea481a

Please sign in to comment.