How to use the homey-meshdriver.Util.calculateZwaveDimDuration function in homey-meshdriver

To help you get started, we’ve selected a few homey-meshdriver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github athombv / node-homey-meshdriver / lib / zwave / ZwaveLightDevice.js View on Github external
'Color Component ID': 2,
					Value: Math.round(red),
				},
				{
					'Color Component ID': 3,
					Value: Math.round(green),
				},
				{
					'Color Component ID': 4,
					Value: Math.round(blue),
				},
			],
		};

		if (SwitchColorVersion > 1) {
			setCommand.duration = typeof duration !== 'number' ? FACTORY_DEFAULT_COLOR_DURATION : Utils.calculateZwaveDimDuration(duration);
		}

		// Fix broken CC_SWITCH_COLOR_V2 parser
		if (SwitchColorVersion === 2) {
			setCommand = new Buffer([setCommand.Properties1['Color Component Count'], 0, setCommand.vg1[0].Value, 1, setCommand.vg1[1].Value, 2, setCommand.vg1[2].Value, 3, setCommand.vg1[3].Value, 4, setCommand.vg1[4].Value, setCommand.duration]);
		}

		return this.node.CommandClass.COMMAND_CLASS_SWITCH_COLOR.SWITCH_COLOR_SET(setCommand);
	}
}

homey-meshdriver

Use this module to make the creation of Z-Wave & ZigBee Homey Apps easier.

ISC
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages