Hi, @alex.49.98!
Up to now, it is not possible to execute scenes using the Rules API but remember that āthenā is an array so it can include several instructions to execute.
Can you still use the old trick of having the rules API recipe turn on a virtual switch, and then having an automation activate the scene whenever that virtual switch comes on?
Or if you are using the Android app, you could just use the virtual switch creator in smartthings labs to create a virtual switch, yes? That would be quite a bit easier for people who are not using Edge Drivers yet. but I donāt believe thatās available in the iOS version at this time.
Hereās a good third-party video on that process:
I know this thread is a little dated at this point, but is it still not possible to use Scenes in the Rules API? I see it listed in the documentation as an operand but I donāt see any examples of it.
If it isnāt possible still (dumbfounding) then what is the best way to set the colorTemperature of a hue light? I see that the capability and command are both colorTemperature but wasnāt sure if you needed to just use the command: {{ temp in K }} or do something different. These two questions are tied together because I have scenes that are already doing the setting of the temperature, but iām not finding any examples of how to set the temperature via the API/Rules API.
Thereās a new community created edge driver which has many different types of virtual devices, just in case you decide you want to use that method without using groovy:
I know it would be better if you could just activate a scene from the rules API, I just donāt know if you can.
Thanks @JDRoberts . I started using that this week, actually. Was running into issues with the old Groovy virtual switches and had to switch over almost all of them. Now iām working on slowly killing old WebCore pistons and trying to use the Rules API as much as possible.
I did find an example where you can use setColorTemperature, so now iām going to try some API calls to figure out the exact format of the JSON. Thinking that if it works in the API it might work in a Rule as well.
Scenes are similar to Routines in that they are basically Rules that are only maintained by the mobile apps. However, unlike Routines, Scenes are recognised as separate entities in the developer docs and have their own API endpoint. I suspect that is a historical thing and that ideally theyād be quietly forgotten about outside the mobile apps.
Curiously, there isnāt a way to execute another Rule from a Rule, or at least not one that I know about. If there was Iād drop all my Scenes in seconds for the same reason I barely use Routines.
So is there a way to execute a Scene in Rules? Of course there is as Routines are doing it. Can it be used by the rest of us? Yes. Do I know what it is? Yes. Am I going to tell you what it is? Not in a public thread Iām not as there may be a reason it isnāt documented for public release and I donāt want to do anything to undermine Rules development.
I am looking for the same thingā¦ how to call Scenes from a Rules APIā¦ I am wondering why there is such ādisconnectionā between the same platformā¦
I donāt know how new/old this is, but there is a āproposedā capability for executing a scene. Once that goes live it looks like that might be the solution?
If it is the one I think you mean, I believe that is simply a capability to allow developers to handle their own concept of āscenesā in a generic sense. Same as there is one for āmodesā.
When it comes to executing Scenes in Rules, the solution is really ridiculously trivial and exactly what youād guess it to be. However there may be a reason why it isnāt published in the API yet, especially as Scenes seem to have one solid foot in the toy department of the mobile app alongside Routines, and a toe in the developer docs and the API alongside Rules, which is all rather inconsistent. Curiously the developer docs says āA previously created Scene can be activated from within a Ruleā but lists that as an operand.
YAML is a superset of JSON and the CLI uses a YAML library for input and output, handling the translation to and from JSON for the API automatically. I use the CLI to manage my Rules and, having been presented with the choice, I prefer to use YAML.
Iāve pondered whether writing the Rules in another language would be worthwhile but it wouldnāt really gain me a lot as Iāve been using the same Rules for a couple of years or more now.
As far as I know, and thatās not much, the YAML format can be used only in CLI. As I find, as a non programmer the CLI interface too intimidating, thatās not an option for me. Thanks to @TAustin for the fantastic API browser which enables people like me to play with templates and adapt routines to make rules. Maybe the rules API will be made more accessible in the future, so at least I could see the rules from the app.