That's unfortunate, thank you for the effort, though.
Have to agree. All these devices have a default duration, and there's an option to send a custom duration for a given command. 0 isn't null and should be a valid, optional duration. Oh well.
Because on/off uses a 3-second duration, the default value for my switches. That duration isn't compatible with turning on the Halo feature of the lights - it just cycles the main light on and off slowly.
All my lighting scenes use a fade, I don't like the instant on-off like a manual switch. So I set one default in my driver (3 seconds) and set variations from that in all my automations. It looks like I'll have to redo my automations to input a duration for every on/off/fade command now.
That would be great, thanks! I'm using this driver as a base, but made the following mods. From what I can gather from the log files, I think the driver does pass the duration of 0 as a parameter, but when it hits webcore the 0 duration is dropped. Webcore only passes the duration value if it's 1-255 (again, I think)...
Driver:
Original section:
def on() {
if (logEnable) log.debug "Turn device ON"
if (logEnable) log.debug "state.level is $state.level"
if (state.level == 0 || state.level == "" || state.level == null) {state.level=99}
setLevel(state.level, 0)
}
def off() {
if (logEnable) log.debug "Turn device OFF"
setLevel(0, 0)
}
def setLevel(value) {
if (logEnable) log.debug "setLevel($value)"
setLevel(value, 0)
}
def setLevel(value, duration) {
if (logEnable) log.debug "setLevel($value, $duration)"
def result =
state.bin = -1
value = Math.max(Math.min(value.toInteger(), 99), 0)
if (value) {state.level = value}
if (logEnable) log.debug "setLevel(value, duration) >> value: $value, duration: $duration"
return delayBetween([
secure(zwave.switchMultilevelV3.switchMultilevelSet(value: value, dimmingDuration: duration))
] , 250)
}
Edited Section:
def on() {
if (logEnable) log.debug "Turn device ON"
zwave.basicV1.basicSet(value: 0xFF).format()
}
def off() {
if (logEnable) log.debug "Turn device OFF"
zwave.basicV1.basicSet(value: 0x00).format()
}
def setLevel(value) {
if (logEnable) log.debug "setLevel($value)"
setLevel(value, 3)
}
def setLevel(value, duration) {
if (logEnable) log.debug "setLevel($value, $duration)"
def result =
state.bin = -1
value = Math.max(Math.min(value.toInteger(), 99), 0)
if (value) {state.level = value}
if (logEnable) log.debug "setLevel(value, duration) >> value: $value, duration: $duration"
return delayBetween([
secure(zwave.switchMultilevelV3.switchMultilevelSet(value: value, dimmingDuration: duration))
] , 250)
}