-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new
toggle
, isOn
, getBrightnessInLumen
and `getTemper…
…atureInKelvin` functions, plus `litra-toggle` CLI * Add functions to get current power state, brightness and temp Add function to toggle power on/off Fix typos Resolves #42 * Update README.md to include new getter and toggle functions Ref #42 * Update CLI to provide brightness and temp Add CLI command for toggle Ref #42 * Add missing power state tests * Apply suggestions from code review for README.md Co-authored-by: Tim Rogers <[email protected]> * Update command descriptions * Change getPowerState to isOn * Update tests/driver.test.ts Co-authored-by: Tim Rogers <[email protected]> * Update src/cli/litra-toggle.ts Co-authored-by: Tim Rogers <[email protected]> * Update tests/driver.test.ts Co-authored-by: Tim Rogers <[email protected]> * chore: build Typescript --------- Co-authored-by: Tim Rogers <[email protected]>
- Loading branch information
Showing
19 changed files
with
538 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const commander_1 = require("commander"); | ||
const driver_1 = require("../driver"); | ||
const utils_1 = require("./utils"); | ||
commander_1.program | ||
.name('litra-toggle') | ||
.description('Toggles a Litra device on or off') | ||
.option('-s, --serial-number <serialNumber>', 'serial number of the Litra device. If this is not specified and multiple devices are connected, this will default to the first identified device, which is not guaranteed to be the same every time you run this command'); | ||
commander_1.program.parse(); | ||
const { serialNumber } = commander_1.program.opts(); | ||
try { | ||
const device = (0, utils_1.getDeviceForCLI)(serialNumber); | ||
(0, driver_1.toggle)(device); | ||
process.exit(0); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.