"Start Level Change" changes lights abruptly

I am not really familiar with Hubitat, but in looking at the updated code I see a potential issue (not sure if it causes problems or not though).

sendToDevice(zwave.switchMultilevelV3.switchMultilevelStartLevelChange(ignoreStartLevel: true, startLevel: device.currentValue("level"), upDown: upDownVal, incDec: 1, stepSize: 1, dimmingDuration: settings."parameter1"!=null? settings."parameter1":3))

Would this fail since parameter1 does not exist on the LZW42? Would it be better to allow a user to specify the duration, like this?

void startLevelChange(direction) {
	//Check if dimming speed exists and set the duration
	int duration=1
	if (dimmingSpeed) duration=dimmingSpeed.toInteger()
    startLevelChange(direction, duration)
}

void startLevelChange(direction, duration) {
	boolean upDownVal = direction == "down" ? true : false
	if (logEnable) log.debug "got startLevelChange(${direction})"
	sendToDevice(zwave.switchMultilevelV3.switchMultilevelStartLevelChange(ignoreStartLevel: true, startLevel: device.currentValue("level"), upDown: upDownVal, incDec: 1, stepSize: 1, dimmingDuration: duration))
}

Being that it’s groovy (I haven’t looked at the code itself), parameters to a method can be defaulted in the declaration itself in the event nothing is passed, e.g.

void startLevelChange(direction, duration = 1) {
    // actions
}

I’ve only done some minimal tinkering in Hubitat apps/drivers, but it should be able to handle defaulting if there’s minimal benefit to method overloading.

Working great for me on red and black dimmers! Thank you @EricM_Inovelli ! I can’t speak to the bulbs.

Hi @EricM_Inovelli have you found something about LZW42 ?

@EricM_Inovelli Can I expect a solution for my LZW42? Yes the bug is corrected on LZW31 but still be there on LZW42 and no more news about it…

Hubitat correct the bug in their latest firmware 2.3.2.118
But their driver don’t have the “dimming speed” setting… :man_shrugging:t3:

Was looking at this with a spare bulb I have, and Inovelli’s current driver appears to use the Switch Multilevel v3 command class. According to the Z-Wave Alliance docs, the LZW42 only supports v2. Changing line 224 (the call in startLevelChange()) to use v2, including removing the parameters that aren’t available in v2, works for me. Something like this:

sendToDevice(zwave.switchMultilevelV2.switchMultilevelStartLevelChange(ignoreStartLevel: true, startLevel: device.currentValue("level"), upDown: upDownVal, dimmingDuration: settings."parameter1"!=null? settings."parameter1":3))

That being said, perhaps the Alliance docs are outdated — maybe v3 is supported and something else is wrong. Anyway, this might be a quick fix for anyone who wants something before Hubitat releases their built-in driver fix or wants to use Inovelli’s driver.

1 Like