Trying to set up an RM lighting controller

Hello, new to Rule Machine here.

I'm trying to set up a single Rule Machine rule that will control my aquarium lighting's virtual switches on/off states. I have the below rule created however I cannot find a way to turn off the unused switches and leave only the most recently activated switch on. As of now, when I try to turn on the Blue switch, since Aqua is still ON, the first IF statement takes effect before getting to the ELSE-IF. What I need for it to do is instead of the IF looking for the switch state ON, I need for it to determine if Aqua was the last triggered switch, or if Blue was the last triggered switch. My most recent attempt as you can see tried using Last Event Device, but that did not solve my problem. - Thank you for your help!

Cancel Delayed Actions
Off: Aquarium 40 Light Blue, Aquarium 40 Light Aqua, Aquarium 40 Light White
IF (Last Event Device switch on(F) [FALSE]) THEN
On: Aquarium 40 Light Aqua
Send POST to: http://192.168.2.55:9876/send?deviceMac=34ea34cce4ff&codeId=l1559071026279
Send POST to: http://192.168.2.55:9876/send?deviceMac=34ea34cce4ff&codeId=l1559069120415 --> delayed: 0:00:01 (cancelable)
Set color: Fish Rack ->Custom color ->Hue: 48 ->Sat: 100 ->Level: 70
ELSE-IF (Last Event Device switch on(F) [FALSE]) THEN
On: Aquarium 40 Light Blue
Send POST to: http://192.168.2.55:9876/send?deviceMac=34ea34cce4ff&codeId=l1559071026279
Send POST to: http://192.168.2.55:9876/send?deviceMac=34ea34cce4ff&codeId=l1559068347266 --> delayed: 0:00:01 (cancelable)
Set color: Fish Rack ->Blue ->Level: 70
END-IF

These are the same condition so they'll both run.

One thing you could try doing is using a local variable and have that keep track of the color. Could make it a string and assign the variable to "Aqua" or "Blue", or could use a number and track it with something like 0=Aqua, 1=Blue. Then in your if statement, compare to the local variable then call the necessary color from there

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.