There are two sensors, one for door opening, the second for movement, as well as a smart switch.
I would like to organize the lights to turn on when both sensors are triggered.
I roughly think of this option: when the door opening sensor is triggered, the motion sensor is checked, if it has the status on, then the light turns on, if one sensor is triggered, nothing happens, when the status of both sensors is off, then the light turns off after a specified period of time ( for example 30 seconds).
Also, as long as the motion sensor sees movement, the light should be turned on.
I hope I explained it clearly.
So far I’m getting what I planned for one sensor at a time, but I can’t figure out how to do it for both to work at once.
[{"id":"bd7f71118b5611ad","type":"tab","label":"КоридорВ","disabled":false,"info":"","env":[]},{"id":"3b94d100d90ff95e","type":"server-state-changed","z":"bd7f71118b5611ad","name":"dver_open","server":"10cea322.6322ad","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.vkhodnaia_dver","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"on","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":60,"y":100,"wires":[["8d3bcef4171922d4"],["8d3bcef4171922d4"]]},{"id":"8d3bcef4171922d4","type":"switch","z":"bd7f71118b5611ad","name":"on and off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":100,"wires":[["8c1edcd7854ed093","4f3043aef367efb3"],["28d2c598e77f179d"]]},{"id":"8c1edcd7854ed093","type":"api-current-state","z":"bd7f71118b5611ad","name":"light_koridorv","server":"10cea322.6322ad","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.koridorv_switch_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":490,"y":80,"wires":[["1e58987b9ed3f457"],[]]},{"id":"1e58987b9ed3f457","type":"api-call-service","z":"bd7f71118b5611ad","name":"On","server":"10cea322.6322ad","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.koridorv_switch_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":690,"y":80,"wires":[[]]},{"id":"28d2c598e77f179d","type":"trigger","z":"bd7f71118b5611ad","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"30","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":550,"y":200,"wires":[["7c7a1c5599ca71d8"]]},{"id":"7c7a1c5599ca71d8","type":"api-call-service","z":"bd7f71118b5611ad","name":"Off","server":"10cea322.6322ad","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.koridorv_switch_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":530,"y":280,"wires":[[]]},{"id":"4f3043aef367efb3","type":"change","z":"bd7f71118b5611ad","name":"Stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":140,"wires":[["28d2c598e77f179d"]]},{"id":"f478a503e847d2d8","type":"server-state-changed","z":"bd7f71118b5611ad","name":"motion_vxod","server":"10cea322.6322ad","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.unknown_vkhod","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"on","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":70,"y":160,"wires":[["8d3bcef4171922d4"],["8d3bcef4171922d4"]]},{"id":"10cea322.6322ad","type":"server","name":"Home Assistant","addon":true}]
I ask for help in solving this problem.