Question for you coders out there

Hello to all you coders out there.
I most certainly am not a coder I'm more of a poke and hope merchant.
I have some LightwaveRF dimmers that use a Custom driver.
Without going into all the boring detail I have found I need 2 drivers depending on my usage.
One needs this.
setLevel(value, duration)
The other needs this.
setLevel(value)
Is there any way in the code I can incorporate both statements in some sort of OR?
Like I say I'm not a coder and have been playing with no joy. Any information / guidance on how to do this is much appreciated.
TIA. :smile:

If you change the parameters to setLevel(value, duration=null) in the setLevel, it will not error out when you only pass the value to the function. Is that what you're asking?

It errors and doesn't actually set the level of the dimmer.
I'll give that a try.
Thanks.

I think you've nailed it.
It appears to be working in both scenarios using the code line you suggested.
I'm using my mobile so it's not ideal to test thoroughly.
Will dive in depth later and let you know.
Early signs are good though.
Thanks again. :smile:

No problem. Had to make that adjustment to a whole bunch of drivers when Hubitat add the duration to the setLevel command.

1 Like

@Ryan780
Just an update for you.
I've changed the driver and allocated it to some devices, done quite a bit of testing and it is now working like a charm.
Thanks again for the solution. :smile::+1:

Now. What else can I break?

1 Like

Quite welcome.

1 Like