UNPKG

@olegivaniv/n8n-nodes-overkiz-tahoma

Version:

This is an n8n community node. It lets you use Overkiz (Tahoma) in your n8n workflows.

58 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.lightsCommands = void 0; function hexToRgb(hex) { if (hex.charAt(0) === '#') { hex = hex.slice(1); } const bigint = parseInt(hex, 16); const r = (bigint >> 16) & 255; const g = (bigint >> 8) & 255; const b = bigint & 255; return [r, g, b]; } const genericOn = { value: 'genericOn', name: 'Turn On', commands: (executionCtx) => [ { name: 'on', parameters: [], }, ], }; const genericOff = { value: 'genericOff', name: 'Turn Off', commands: (executionCtx) => [ { name: 'off', parameters: [], }, ], }; const genericSetRGBColor = { value: 'genericSetRGBColor', name: 'Set Color', commands: (executionCtx) => { const hexColor = executionCtx.getNodeParameter('color', 0); return [ { name: 'setRGB', parameters: hexToRgb(hexColor), }, ]; }, }; exports.lightsCommands = { DimmerLight: { commands: [genericOn, genericOff, genericSetRGBColor], }, DimmerHueSatOrCTLight: { commands: [genericOn, genericOff, genericSetRGBColor], }, DimmerColorTemperatureLight: { commands: [genericOn, genericOff, genericSetRGBColor], }, }; //# sourceMappingURL=light.js.map