Sensor with a trigger

Your initial question also said it was ok for the sensor to go off with the switch, though it wasn’t required to.

Though I suspect this is a language barrier thing and what you really meant was it ‘should not go OFF when switch 1 goes OFF’.

In this case the input boolean suggested by Bartem is the easiest solution.

DEFAULT (NO TRIGGER): state = FALSE
IF TRIGGERED alarm_central == ON and door == ON then state = TRUE
IF TRIGGERED alarm_central == OFF then state = FALSE

So if the default state if false and alarm_central is triggered (ON) but door==OFF then the state will be the default, namely false. However, you said you only want the state to be false if alarm_central is OFF. Therefore the pseudo-code can produce an undesired result.

Yes, you are right. I used bad english words. Anyway, I described the scenario twice, and added a “DEFAULT” keyword which should be clear enough. In any case, what Bartem suggested is the right solution

No, because I wrote that “that goes to ON state by triggering when switch_1 goes to ON” in the initial question. Which means that its default state is OFF. Then I added the word “default” to be more clear. And I also described a scenario.

You may have written that but your pseudo-code doesn’t implement it.

Anyway, looking forward to seeing what you created to meet your requirement.