Rules vs Routines

I have several routines currently installed in my hub. Whereas there’s a UI that helps you create a routine, the documentation on the format of a rule is surely lacking today. It’s unfortunate that there’s no ability to capture an existing routine in JSON format so that you can refine it as a rule.

For people creating rules, is it a question of guessing the syntax or is there a better way?


1 Like

The Rules API is documented here

Rules API

and some sample rules are documented here

Rules Examples

And rather than trying to use a tool like Postman to create and manage your rules, there is an easier interface available via the API Browser+ from @TAustin.

Rules are defined in the API Reference so the syntax is well defined. I wouldn’t go as far as well explained but certainly well defined.

I have yet to find out how to see the Rules that the app manages as Routines. It would be handy to see exactly what they have implemented as it isn’t always clear.

Scenes are really just single payload only Rules wearing a frock. They uncomfortably straddle the divide between developer tools and end user tools. They are recognised as a type of Automation alongside Rules in the developer documentation and the API (Routines are not covered in either). However they can only be managed like Routines in the app and are subject to the same editing abuses when devices are deleted which I find inexcusable. It is possible to see the actual Rules though.

Perhaps surprisingly, Routines and Scenes have access to functionality that is not documented in the API reference. Sometimes you can use it anyway if you figure out the syntax (e.g. executing Scenes), but other stuff is just unsupported (notifications). Toggle is another thing the Routines can do that is undocumented and possible also unsupported.