Skip to content

Commit

Permalink
Fix: Color temperature could end up out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
vieira committed Aug 21, 2023
1 parent 4655e96 commit 0219b50
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bulbs/temperature.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Temperature = Device =>
const Temperature = (Device) =>
class extends Device {
constructor(props, platform) {
super(props, platform);
Expand Down Expand Up @@ -47,11 +47,11 @@ const Temperature = Device =>
}

get temperature() {
return this._temperature - 1;
return this._temperature;
}

set temperature(kelvin) {
this._temperature = 10 ** 6 / Number(kelvin);
this._temperature = Math.floor(10 ** 6 / Number(kelvin));
}

async setTemperature(mired) {
Expand Down

0 comments on commit 0219b50

Please sign in to comment.