Hi there. Is there any good (thorough?) documentation for the ST flavor of Groovy? Specifically, I am not familiar with the methods and properties of objects.
For example, I copied the code below from another App, trying to list devices. I am not sure how to use the devices.find, what the types might be, wildcards, etc.
This is a specific question, but I am looking for a reference so I don’t have to bug you guys.
For example, I have some dimmer switches. They have both a switch and a switchLevel capability.
The Capability table shows a call of setLevel(Number, Number). What’s the second number? Is there a more detailed definition of those capabilities/functions?
There are some commands like that where the parameters aren’t so clear. If I remember correctly, for most switchLevel devices you can actually drop the second argument altogether and just do use the first parameter to dim the lights:
setLevel(50) //dim to 50%.
Only a subset of the switchLevel devices support the second parameter of the setLevel() command which is intended to be used for the duration over which to dim. I don’t recall if it is in seconds or milliseconds as my dimmer switches don’t support the second parameter, but you would do something like:
setLevel(50, 3) //dim to 50% over 3 seconds(?)
(To be clear, I can still send the second parameter to my devices which don’t support it, but the devices just dim on normally and ignore the second parameter)
In my Web API smart App, I am trying to list ALL the devices. Why doesn’t this work? (Adapted from a filter that was looking for a specific type of device)
I am now realizing how mistaken I was. First I was assuming there was a “devices” list with everything in it, and that the “device(it, type)” function was filtering. Haha. No. I was also assuming that “type” was a key in the list. Not true either.
I’ve almost got it. Thanks for even looking at the craziness.
Sometimes working through it and figuring out what you did right and what you did wrong is the best way to learn! Keep at it, it sounds like you are making progress!
Our capabilities documentation is lacking. I love that we have a community of rock stars willing to help people out. But obviously, these types of things should be better documented.