Here is a real World example from my door/motion sensor out of my database (german but understandable, I think). The door sensor is mounted on the inside of the door:
Block 1: Wife is kicking out the cat. With only this sensor I cannot detect if she is in the house. She stayed inside.
'66236', '2020-04-16 06:06:02', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66238', '2020-04-16 06:06:08', 'door1', 'Alarm', '1', '(door1) offen'
'66239', '2020-04-16 06:06:22', 'door1', 'Alarm', '0', '(door1) geschlossen'
'66242', '2020-04-16 06:06:32', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
Block 2: Wife is preparing the dog for walking and leaving the house.
'66356', '2020-04-16 06:49:01', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66358', '2020-04-16 06:49:20', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66360', '2020-04-16 06:49:27', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66362', '2020-04-16 06:49:42', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66364', '2020-04-16 06:49:54', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66365', '2020-04-16 06:50:12', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66366', '2020-04-16 06:50:41', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66367', '2020-04-16 06:51:03', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66368', '2020-04-16 06:51:07', 'door1', 'Alarm', '1', '(door1) offen'
'66369', '2020-04-16 06:51:13', 'door1', 'Alarm', '0', '(door1) geschlossen'
Block 3: Wife and the dog are coming home.
'66396', '2020-04-16 07:39:35', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66397', '2020-04-16 07:39:37', 'door1', 'Alarm', '1', '(door1) offen'
'66398', '2020-04-16 07:39:47', 'door1', 'Alarm', '0', '(door1) geschlossen'
'66399', '2020-04-16 07:39:57', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66400', '2020-04-16 07:40:05', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66401', '2020-04-16 07:40:21', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66402', '2020-04-16 07:40:28', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66403', '2020-04-16 07:40:43', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66404', '2020-04-16 07:40:49', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66405', '2020-04-16 07:41:05', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
'66406', '2020-04-16 07:41:18', 'motion_door1', 'Alarm', '1', '(door1) Bewegung ein'
'66408', '2020-04-16 07:41:34', 'motion_door1', 'Alarm', '0', '(door1) Bewegung aus'
The first problem is the long time for the motion message. The time between open an close is short. If somebody moves quick it is not possible to detect inside/outside. Whats about several persons? What is when the person comes in to get something and leaves?