Simultaneously running rule

Hi,

Does anyone know if it possible to run two rules at the same time. I have two MQTT triggered rules to gradually turn on two lights one after the other but I wanted to know if it possible to create two rules that run together.

Maybe i will have to trigger on MQTT rule and then fire another MQTT trigger within the first rule?

Is it possible to run both rules side by side ?

Many Thanks

Yes, each rule gets triggered into its own thread. So two rules that trigger off of the same event will run at roughly the same time. You can also trigger a rule from another rule by posting a command or update to an Item that triggers that other rule.

That word “roughly” is an important one. You do not have a lot of direct control to control the timing for when one rule start and the next rule starts so you cannot depend on specific timing unless you set up locks which quickly gets really complicated.

That being said, I’m not sure you want to do that based on your explanation. You will have a lot more precise control over the timing and ordering of the lights turning on if you implement the turning on of both lights in the same rule. If you are trying to avoid duplicate code, look into lambdas.