I think you have some confusion over how numbers can be represented in Groovy. You can use 100
or 0x64
(both as literals, not as strings) and both are equivalent. They are both 100
in decimal (the common, human-friendly base-10 number system you are undoubtedly used to).
You can try some fun tests in app or driver code to see for yourself:
// the obvious:
log.debug(100 == 100) // will print true
// decimal vs. hexadecimal (same number):
log.debug (100 == 0x64) // will print true
// decimal vs. hexadecimal (different numbers):
log.debug (64 == 0x64) // will print false
In your example above, there is yet a third possibility, 0064.
This is actually octal and would be 52
in decimal. A 0
prefix in Groovy is octal (and 0064
is equivalent to 064
).
Your device shouldn't care what base (octal, decimal, hex, etc.) you use on the Hubitat/Groovy side. You can use 100
if that is easier to work with. If you type 0x64
, it's literally the same. Most Z-Wave docs use hex, so it's what a lot of Z-Wave enthusiasts are used to seeing, but it's all the same in the end.
Note that, as above, your numbers here are octal: 01
, 032
, and 064
(or 1
, 26
, and 52
in decimal). These seem like odd values since you probably want 0-100 and not 0-64, but there could be oddities (perhaps working in your favor) as a result of data type conversions if these aren't really a Short
. Groovy is normally smart about this but can be weird sometimes. I don't know what's going on in your case.
If you want my advice for how I'd do it, I'd do something like:
Short briVal = 0x64 // or, again, 100 would be equivalent
cmds.add(zwave.indicatorV3.indicatorSet(indicatorCount:1, value: 0, indicatorValues:[[indicatorId:0x50, propertyId:1, value:briVal]]).format())
That way, you know briVal
is a Short
. You can retrieve the value from the device, as you are above, if you need to, and just make sure it's a Short
by the time you pass it to the Z-Wave method. (You don't necessarily need to be this careful with data types as long as it's a number, but I always like to be sure...)