I am having an issue creating a custom command for a Homeseer dimmer.
I created a command to set a status light setStatusLed(4,1,1) which accepts integers.
However, when I try to create a command to reset the status as in setStatusLed(4,0,0), the command does not create... Well actually it creates, but everything is blank. I have tried using a built-in driver using a virtual dimmer and have the same issue.
If I make the command a string and then change it to an integer in the function, it works.
For whatever reason, Custom Commands is not accepting the number 0 as a number or integer.
Ya that's here i hit as well. Download the custom button driver and make commands for the buttons only requires on parm vs three. I'd didnt get any nulls doing it this way
Did you try to add a string parameter of 0, 4, 4 or did you try to add 3 parameters of 0 and 4 and 4? What device driver are you trying to create the custom command for?
Why are you setting it to integer? Use a string instead. That's what the built in driver uses. Of course you can't set an integer to zero....it's not an integer. LOL
int : By default, the int data type is a 32-bit signed two's complement integer, which has a minimum value of -231 and a maximum value of 231-1. In Java SE 8 and later, you can use the int data type to represent an unsigned 32-bit integer, which has a minimum value of 0 and a maximum value of 232-1.Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)
Because of a bug you have revealed. It won't accept zero as a number parameter, as you discovered. That's a bug. It will accept a string with value "0". There was a critical test in the code to see if there has been a value set or not, and that test failed when the value is zero.
Okay. It's slow going but I'm starting to get this groovy shi....stuff. Thanks Bruce.
Is there any real advantage in this case of using string vs number? I understand if you want to do math with it then it would have to be a number value but is there any other reason to pick one over the other? (And i apologize if that's a much bigger question than I realize it is. I'm just curious.)