Use the device tracker to trigger the flow and then wait for the door to open.
[{"id":"f36bee7a6dfde5c5","type":"trigger-state","z":"8e6ef4f6cbb13d83","name":"","server":"","version":5,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entities":{"entity":["device_tracker.dahua"],"substring":[],"regex":[]},"debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"home"},{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"not_home"},{"targetType":"entity_id","targetValue":"sun.sun","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"below_horizon"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"x":340,"y":2310,"wires":[["33d574a172e5ac4e"],[]]},{"id":"33d574a172e5ac4e","type":"ha-wait-until","z":"8e6ef4f6cbb13d83","name":"","server":"","version":3,"outputs":2,"entities":{"entity":["binary_sensor.door"],"substring":[],"regex":[]},"property":"state","comparator":"is","value":"on","valueType":"str","timeout":"300","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"date"}],"x":620,"y":2310,"wires":[[],[]]},{"id":"dcbc2b2e8ca85eb9","type":"global-config","env":[],"modules":{"node-red-contrib-home-assistant-websocket":"0.80.3"}}]
Edited to add sun condition to trigger.