Groups of actions in Rules API to control serial / parallel execution

If you look at the JSON for a Rule that was created by the app which has a delayed action, it creates an action of type “group” which executes serially, starting with a sleep. For example:

        {
          "group": {
            "actions": [
              {
                "sleep": {
                  "duration": {
                    "value": {
                      "integer": 10,
                      "type": "integer"
                    },
                    "unit": "Second"
                  },
                  "strategy": "Ignore"
                },
                "type": "sleep"
              },
              {
                "command": {
                  "devices": [
                    "<device ID>"
                  ],
                  "commands": [
                    {
                      "component": "main",
                      "capability": "switch",
                      "command": "on"
                    }
                  ],
                  "sequence": {
                    "commands": "Serial",
                    "devices": "Serial"
                  }
                },
                "type": "command"
              }
            ],
            "sequence": {
              "actions": "Serial"
            }
          },
          "type": "group"
        }

However, “group” is not recognized by the Rules API when creating a Rule with the CLI. The work around I’ve found is to use an “if” statement with an always true condition (ex: 1 == 1), and then control the sequence of the “then” clause. This allows me to run the overall rule actions serially while parallelizing certain portions of them or vice versa.

Is there a cleaner (if poorly documented) way to do this? Some equivalent of “group” in Rules API?

Mike

I suspect if there was already a clean way of doing it they wouldn’t have created “group”.

I can’t imagine how the suggestion of webCoRE like functionality in the Rules API could ever have been achieved with the existing binary tree architecture, and the triggering of the Rules when you have nested or multiple ‘if’ actions or multiple actions is so hard to get to grips with that I wish neither existed so I wouldn’t have ever tried to use them. From once being one of its champions on this forum I now find myself wishing they’d put the existing Rules API out of its misery.

Just replace it with a single level of ‘if … then … else’ based on the version of Rules available to Routines, add the ability to execute other Rules, and then try and implement a way of working with variables. That’s plenty.

Sorry, but when talking about the Rules API a rant can never be far away.