Beginner Help With Rules

HI, I am trying to create my first rule. I have an RGB connected via MQTT which works fine. I have 3 switches setup for each color (just for testing). I want to create a rule to turn off the other 2 switches when the other switch is on.

i.e. Turn on the Blue LED, then the red and green switches should turn off. I have tried but no luck.

Log show Jetty request 3053767 failed: null when trying to load the rule.

Rule is
rule Board1_BlueLEDChanged
when
Item Board1_BlueLED received command
then
if (Board1_BlueLED.state == 1) {
Board1_RedLED.sendCommand(OFF)
Board1_GreenLED.state.sendCommand(OFF)
}
end

put quotes around the name of the rule

rule "Board1_BlueLEDChanged"

Also, try received update instead of received command

I just realized i’ve put out opinions i really don’t have good enough knowledge about. The last thing i would do is put ut misleading information therefore i deleted my contribution. Hope i’m pardoned :slight_smile:

2 Likes

Thanks , the quotes fixed the issue. Also there was a syntax error

Board1_GreenLED.state.sendCommand(OFF)

Should not have the .state. bit. Fixed this, and all working well. Thank you very much

1 Like

great!