homebridge-philips-hue-sync-box
Version:
Homebridge plugin for the Philips Hue Sync Box.
18 lines • 825 B
JavaScript
import { BRIGHTNESS_MAX_HOMEKIT, BRIGHTNESS_MAX_SYNCBOX } from './constants.js';
/**
* Converts a HomeKit brightness value (0-100) to a Sync Box brightness value (0-200)
* @param homekitValue - The HomeKit brightness value (0-100)
* @returns The Sync Box brightness value (0-200)
*/
export function convertHomekitToSyncBox(homekitValue) {
return Math.round((homekitValue / BRIGHTNESS_MAX_HOMEKIT) * BRIGHTNESS_MAX_SYNCBOX);
}
/**
* Converts a Sync Box brightness value (0-200) to a HomeKit brightness value (0-100)
* @param syncBoxValue - The Sync Box brightness value (0-200)
* @returns The HomeKit brightness value (0-100)
*/
export function convertSyncBoxToHomekit(syncBoxValue) {
return Math.round((syncBoxValue / BRIGHTNESS_MAX_SYNCBOX) * BRIGHTNESS_MAX_HOMEKIT);
}
//# sourceMappingURL=brightness.js.map