Skip to content

Commit

Permalink
wrong check in wrong place
Browse files Browse the repository at this point in the history
  • Loading branch information
3nth committed May 8, 2022
1 parent e18bbd3 commit 953ee2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# An Elgato plugin for Scrypted

Supports Elgato Key Light & KeyLight Air
Supports Elgato Key Light & Key Light Air

## Development

Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ElgatoDevice extends ScryptedDeviceBase implements OnOff, Brightness, Colo
this.brightness = this.light.options.lights[0].brightness;
let temperature = this.light.options.lights[0].temperature;
let kelvin = Math.round(1000000 * Math.pow(temperature, -1))
if(kelvin > 7000) kelvin = 7000;
if(kelvin < 2900) kelvin = 2900;
this.temperature = kelvin;
}

Expand All @@ -58,8 +60,8 @@ class ElgatoDevice extends ScryptedDeviceBase implements OnOff, Brightness, Colo

async setColorTemperature(kelvin: number) {
let temperature = Math.round(987007 * Math.pow(kelvin, -0.999));
if(temperature > 7000) temperature = 7000;
if(temperature < 2900) temperature = 2900;
if(temperature > 344) temperature = 344;
if(temperature < 143) temperature = 143;
await this.light.setColorTemperature(temperature)
this.updateState();
}
Expand Down

0 comments on commit 953ee2c

Please sign in to comment.