Rule: Door open - no movement - Notification

Hi,

What’s wrong with my rule? probably something simple, but i don’t see it

Door opens light goes on no problem there.
Now i want to send a push notification when my motion sensor is NOT on

If i remove the If statment its working, sending the notification always when i come in and leave

But i want to add a condition if movement ditected don’t send

The sensor i use is the FGMS-001 from fibaro

This is my code so fare:

rule "HalLichtAanDeurOpen"
         when   
            Item E0Dvoordeur_DoorStatus changed from CLOSED to OPEN 
         then   
            {
                    E0LHAL_Switch.sendCommand(ON)
                    If E0MHAL_BinarySensor = CLOSED 
                    sendBroadcastNotification("Voordeur open")
                                      
            }

try this

rule "HalLichtAanDeurOpen"
     when   
        Item E0Dvoordeur_DoorStatus changed from CLOSED to OPEN 
     then   
        {
                E0LHAL_Switch.sendCommand(ON)
                If (E0MHAL_BinarySensor == CLOSED){ 
                       sendBroadcastNotification("Voordeur open")
                }                  
        }
end

Assuming E0MHAL_BinarySensor is an item, then you would need to do this:

If (E0MHAL_BinarySensor.state == CLOSED) {
  sendBroadcastNotification("Voordeur open")
}

Also, you don’t need the brackets ( {…} ) directly after ‘then’ and before ‘end’.

Thanks for your quick response
I tried your code with = and == but it’s not working

I used CLOSED and OFF

This is my last version

rule "HalLichtAanDeurOpen"
     when   
        Item E0Dvoordeur_DoorStatus changed from CLOSED to OPEN 
     then   
                E0LHAL_Switch.sendCommand(ON)
                If (E0MHAL_BinarySensor.state == OFF){ 
                sendBroadcastNotification("Voordeur open")
                }                  
 end

If I remove the if statment the send command is executed.
So it must be something within the if statment i gues

If or if ? Lettercase is important in Rules

Thanks for all your help, it’s working now

Are rules case sensitive? and what are the rules about cases?

This is the final code:

rule "HalLichtAanDeurOpen"


     when   
        Item E0Dvoordeur_DoorStatus changed from CLOSED to OPEN 
     then   
                E0LHAL_Switch.sendCommand(ON)
                if (E0MHAL_BinarySensor.state == OFF){ 
                sendBroadcastNotification("Voordeur open")
                }                  
 end