Not sure i really understand that flow even in the slightest bit.
Assuming Motion 1 and Motion 0 are Motion On and Off? Also assuming same for the Door.
But how to turn this into something I can actually work with that might be a different story.
Working with someone on a reddit post I was able to come up with this which seems to do the trick perfectly.
[{"id":"c3f07a50346d189c","type":"group","z":"7b906bdd2be7a09c","name":"Bonus Room Occupancy","style":{"fill":"#d1d1d1","label":true,"color":"#ff0000","stroke":"#ff0000"},"nodes":["661e8487f5a6103f","142cd3cea156f49e","01982287983a03b1","b9c2cef79c0f5ae8","80a10a95d04c6fc0","214e2b4be4b78e42","b2f5ea734730d2c7","95c1f6dd5101f8a9","f36d5ca986cc9871","117e245e2c7cafd3","5bc26c2dd88d4831","b16edd49b625d05d","2d82ca7f758cb840","194f6264621b6f04","5d9dc49dab2bea14","4cf6a16c9d14fc8a","f70964ee06900d78","0ca807f1d2c4eed3","42e0a10b16017cc5"],"x":34,"y":79,"w":1372,"h":362},{"id":"661e8487f5a6103f","type":"trigger-state","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Door Opens","server":"c8d073b3.907a4","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bonus_room_door_sensor_contact","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"targetType":"entity_id","targetValue":"input_boolean.bonus_room_occupancy","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":150,"y":120,"wires":[["01982287983a03b1"],[]]},{"id":"142cd3cea156f49e","type":"trigger-state","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Motion Detection","server":"c8d073b3.907a4","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bonus_room_motion_sensor_occupancy","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"targetType":"entity_id","targetValue":"input_boolean.bonus_room_occupancy","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":160,"y":180,"wires":[["01982287983a03b1"],[]]},{"id":"01982287983a03b1","type":"api-call-service","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Bonus Room Occupancy - On","server":"c8d073b3.907a4","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.bonus_room_occupancy"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":430,"y":140,"wires":[[]]},{"id":"b9c2cef79c0f5ae8","type":"trigger-state","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Door Sensor","server":"c8d073b3.907a4","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bonus_room_door_sensor_contact","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"targetType":"entity_id","targetValue":"input_boolean.bonus_room_occupancy","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":150,"y":240,"wires":[["80a10a95d04c6fc0"],[]]},{"id":"80a10a95d04c6fc0","type":"delay","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":320,"y":240,"wires":[["214e2b4be4b78e42"]]},{"id":"214e2b4be4b78e42","type":"api-current-state","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Motion Detector Status","server":"c8d073b3.907a4","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.bonus_room_motion_sensor_occupancy","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":530,"y":240,"wires":[["b2f5ea734730d2c7"]]},{"id":"b2f5ea734730d2c7","type":"switch","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":740,"y":240,"wires":[["0ca807f1d2c4eed3"],["95c1f6dd5101f8a9"]]},{"id":"95c1f6dd5101f8a9","type":"api-call-service","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Bonus Room Occupancy - Off","server":"c8d073b3.907a4","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.bonus_room_occupancy"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":990,"y":240,"wires":[[]]},{"id":"f36d5ca986cc9871","type":"trigger-state","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Motion Detection Door Open","server":"c8d073b3.907a4","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bonus_room_motion_sensor_occupancy","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"targetType":"entity_id","targetValue":"binary_sensor.bonus_room_door_sensor_contact","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":180,"y":340,"wires":[["5bc26c2dd88d4831"],[]]},{"id":"117e245e2c7cafd3","type":"api-current-state","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Motion Off For 30 Seconds","server":"c8d073b3.907a4","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.bonus_room_motion_sensor_occupancy","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"30","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":680,"y":340,"wires":[["2d82ca7f758cb840"],["194f6264621b6f04"]]},{"id":"5bc26c2dd88d4831","type":"delay","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":440,"y":340,"wires":[["117e245e2c7cafd3"]]},{"id":"b16edd49b625d05d","type":"api-call-service","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Bonus Room Occupancy - Off","server":"c8d073b3.907a4","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.bonus_room_occupancy"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":340,"wires":[[]]},{"id":"2d82ca7f758cb840","type":"api-current-state","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"Bonus Room Door Sensor","server":"c8d073b3.907a4","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.bonus_room_door_sensor_contact","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"30","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":960,"y":340,"wires":[["b16edd49b625d05d"],["4cf6a16c9d14fc8a"]]},{"id":"194f6264621b6f04","type":"link out","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","mode":"link","links":["5d9dc49dab2bea14"],"x":795,"y":400,"wires":[]},{"id":"5d9dc49dab2bea14","type":"link in","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","links":["194f6264621b6f04"],"x":365,"y":400,"wires":[["5bc26c2dd88d4831"]]},{"id":"4cf6a16c9d14fc8a","type":"link out","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","mode":"link","links":["f70964ee06900d78"],"x":1075,"y":400,"wires":[]},{"id":"f70964ee06900d78","type":"link in","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","links":["4cf6a16c9d14fc8a"],"x":285,"y":400,"wires":[["5bc26c2dd88d4831"]]},{"id":"0ca807f1d2c4eed3","type":"link out","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","mode":"link","links":["42e0a10b16017cc5"],"x":805,"y":180,"wires":[]},{"id":"42e0a10b16017cc5","type":"link in","z":"7b906bdd2be7a09c","g":"c3f07a50346d189c","name":"","links":["0ca807f1d2c4eed3"],"x":215,"y":280,"wires":[["80a10a95d04c6fc0"]]},{"id":"c8d073b3.907a4","type":"server","name":"Home Assistant","addon":true}]