This is a home automation/AI project that I am currently figuring out details for, and currently I'm trying to figure out a way that i can detect which direction someone is walking through a door so that if someone is walking into the room the "AI" would play a welcome message, and if they were leaving the room it would play a goodbye message.
The only thing I can think of to be able to do this is to use 2 sensors such as laser break sensors or ultrasonic sensors which will use the information of one being tripped before the other one to determine which direction the person is going, a problem I can see with this though is the actual door tripping one of the sensors