Custom action

I have a Fibaro fgs222 switch set up and working fine thanks to the special driver.
It has ON, OFF, ON1, OFF1, ON2 and OFF2.
Basically that translates into two switches with ON and OFF working both of them together.
I have it connected up to my velux controller and when ON1 and OFF2 then they open and when ON2 and OFF1 then they close.
My problem is that I want to be able to get Alexa to open and close so I created to virtual switches Velux Open and Velux Close.
What I then thought I’d do is create a RM arhat when Velux Open is on the it turns on the correct switches however these are commands and I don’t know how to call them?

Sounds like you're on the right track! You can run a custom command in Rule Machine by using the Set Mode or Variables, Run Custom Action > Run Custom Action selection in the UI when creating your actions. Here's what a rule might look like:

Trigger: Virtual Switch *changed*


IF (Virtual Switch is ON) THEN
  on1() on Velux windows
  off1() on Velux windows

From your screenshot, it appears these commands do not need any parameters, so ignore the buttons in the UI that offer to add parameters. If you're unfamiliar with the RM UI itself, here's one video that may get you started and shows something similar to the above conditional structure (though your actions are different and the conditions themselves simpler): Rule Machine 2: Advance Conditional Rules - YouTube

I was confused by the parameters so I was nearly there. Thanks very much for your help I’ll try it.

Just tried it and nothing happened. I got this in the logs.

What does the action line actually look like? If you tried adding a parameter but changed your mind, try deleting that entire action and trying again without attempting to add one at all (just ruling out some oddity with how RM might handle this case).

This is the entire RM entry. I had messed about with parameters before settling for null so I will try to delete the entire rule and start again cleanly. Thanks.

I don’t know how you did that but I just recreated the same rule from scratch and it worked perfectly. It’s taken me all day trying so I’m very grateful. Cheers