Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint new-cap: ["error", { "newIsCap": false }] */
const hue = require('node-hue-api').v3
const hex2rgb = require('../lib/hex2rgb')
const db = require('../lib/db')
if (process.argv.length !== 3) {
console.warn('This script must be run as `node brightChecker.js ID`, where ID is the number Hue has for light')
process.exit(1)
}
db.event.on('loaded', function () {
const bridgeInfo = db.settings.findOne({ type: 'hue' })
if (!bridgeInfo) {
console.warn('Did you forget to run Hue settings setup?')
process.exit(1)
}
module.exports = function PhilipsHueService(gladys, serviceId) {
// require the node-hue-api module
// @ts-ignore
const hueClient = require('node-hue-api').v3;
const philipsHueLightHandler = new PhilipsHueLightHandler(gladys, hueClient, serviceId);
/**
* @public
* @description This function starts the PhilipsHueService service
* @example
* gladys.services['philips-hue'].start();
*/
async function start() {
logger.log('starting Philips Hue service');
philipsHueLightHandler.init();
}
/**
* @public
* @description This function stops the PhilipsHueService service