Multiple conditions in IF part of a rule

Hello there,

I tried to create a rule which contains multiple conditions in the if… part.

rule "React on Sunset Event"
when
    Channel "astro:sun:local:set#event" triggered START   
then
    if(VPresence == OFF && Switch1 == OFF){
    sendCommand(Lampe1, ON) 
    }
end

Seems that this does not work always as expected. Is it posible to combine two conditions in this way? VS Code dos not complain on syntax errors…

Greetings

Gufti

If those two things in your if() are Items, you probably want to be testing their .state
Everybody makes this mistake all the time :slight_smile:

You also want to use the sendCommand method instead of the action:

    Lampe1.sendCommand(ON) 

Hi,

I just modified the rule as you both suggested. Let’s see what happens later when “astro:sun:local:set#event” triggers…

Thanks…

Gufti

Why? :slight_smile: What is de difference?

1 Like