Interesting issue with Device Handler and Aeotect Nano Dimmer (ZW158) with WallSwipe (ZW111), setting parameter 64 (0x40)

Greetings all.

I have been modifying Aeotec Nano Dimmer Device Handler by Eric Maycock, Dale Phurrough.

I have modified the Device Handler to include the options to set the WallSwipes colours at rest and for swipe gestures.

But I’ve had a really interesting (possible bug) arise.

The Parameter number for the Swipe gestures are 65-68 Decimal (0x41-0x44). I have been able to set and update this parameters without any issues. However, with I try to set 64 (0x40) which is the WallSwipes colour, it does not update and the checking the Live Error Log when issuing the command, a receive the following error: " java.lang.NumberFormatException: For input string: “‭838861055” @line 458 (coerceToInteger)"

What is odd about this, is the only bit of code to change between all of those colour settings , is the parameter number. Even if I delete the Value entry, cut and paste a working Gesture one and change just the parameter value, it fails! Below is the code.

<Value type="byte" byteSize="4" index="64" label="Wallswipe Colour" min="0" max="1677721599" value="184549375" setting_type="zwave" fw="">
    <Help>
        Includes data:
        1 = Brightness Level (16777216 - 1660944384)
        2 = Colour value of RED (65536 - 16711680)
        3 = Colour value of Green (256 - 65280)
        4 = Colour value of Blue (0-255)
        Example: Add together. i.e. Full RED, 1660944384+16711680=1677656064 (0x63FF0000), full GREEN, 1660944384+65280=1661009664 (0x6300FF00)
    </Help>
</Value>

<Value type="byte" byteSize="4" index="65" label="Wallswipe Colour Gesture action is UP" min="0" max="1677721599" value="855638015" setting_type="zwave" fw="">
    <Help>
        Includes data:
        1 = Brightness Level (16777216 - 1660944384)
        2 = Colour value of RED (65536 - 16711680)
        3 = Colour value of Green (256 - 65280)
        4 = Colour value of Blue (0-255)
        Example: Add together. i.e. Full RED, 1660944384+16711680=1677656064 (0x63FF0000), full GREEN, 1660944384+65280=1661009664 (0x6300FF00)
    </Help>
</Value>

I have inserted into the code, logging command to see the value being entered into the code and the result is below .

debug ‭838861055
java.lang.NumberFormatException: For input string: “‭838861055” @line 458 (coerceToInteger)

And this is the code throwing the exception:

def coerceToInteger(candidate) {
if (candidate instanceof Boolean)
return candidate ? 1 : 0
candidate = candidate.trim()
return candidate.toInteger()
}

For some reason, oblivious to me, it just does not like the code for setting parameter 64 despite the only difference being, the index value.

And for another curve ball, I was able to set parameter 64 yesterday with no issues!

I’m a bit lost as to what is going on here.

Any help appreciated.

Many thanks in advance.

Bald_Noggin.

Have you deleted and recreated the number in case of non-printable characters somehow having sneaked in to it? Kind of looks like you have.

I have tried that but without success unfortunately.

I have set up some logging points in order to see what is giong one and I have just discovered something, very interesting.

The bottom logging line is result of the cached value (7,255,0,0)
Middle line, the value to be updated to but as a String Type.
The top is of course, the exception.

20:40:59: error java.lang.NumberFormatException: For input string: “‭1677721599” @line 459 (coerceToInteger)
20:40:59: debug Device parameter 64 will be updated to ‭1677721599
20:40:59: debug Device parameter cache 64 is [7, 255, 0, 0]

What does one do when all else fails, reset it.

Looks like something may have been written to that parameter that it didn’t like and was preventing it from updating correctly again. Odd really because the program should have caught it in the first place.

Anyhow, I reset it this morning and I can now set the parameters without any more exceptions being thrown.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.