Problem with rule .state ==

Hi,
I try to create a rule who turns ON a wall plug 2 if movement is detected from one of two motion detectors - or from both.
The rule shall only trigger if another wall plug 1 has the status ON.
It’s for an alarm system.

Here my rule:

rule “Alarm” //Alarmanlage scharf und Bewegungsmelder wozi loest aus

when
Item alarm_ein.state == ON and // wall plug 2 ON
{Item bewegung_wozi_motion received update OPEN or Item bewegung_flur_motion received update OPEN}
then
sendCommand(garten_r, ON)
logInfo(“Regel Alarmanlage”, “Alarmanlage an”)
pushover(“Alarmanlage an!”)
end

My problem:
a) The alarm_ein.state == ON do not work, it seems to have no function.
b) the both movement items, linked with an OR do not run. Do I have to set different brackets?

Hope you can help me.

Please read the WIKI - https://github.com/openhab/openhab/wiki/Rules#item---event-based-triggers.

Thanks for the answer, but unfortunately it do not help me. There is no hint for the command .state.
Therefore my problem remains. Or haven’t I’ve not seen the right info in the WIKI?

Read closely the entire page @ben_jones12 posted. Pay particular attention to the “Rule Triggers” section.

What you have in this rule is both logically and syntactically incorrect.

A Rule trigger is based on an event, not an Item’s state. Events never take place at the same time therefore it makes no sense to use “and” nor does it make sense to group event triggers. It therefore makes no sense to group triggers either. The rule triggers when the event occurs, not when all of the Items that are part of the triggers meet certain conditions.

Per the syntax documented on the wiki page, the following are the only acceptable ways to trigger based on an Item’s state.

Item <item> received command [<command>]
Item <item> received update [<state>]
Item <item> changed [from <state>] [to <state>]

Notice that there is no “.state ==”

Again, these are events so what you really want is something like:

when
    Item beweggung_wozi_motion received update OPEN or
    Item bewegung_flur_motion received update OPEN
then
    if(alarm_ein.state == ON) {
        sendCommand(garten ...
    }
end

Thanks both of you. Please consider that I am a Newbie and still learning.
But now I know how to create such a rule.

Thanks again.