Currently, we use a state variable to determine whether the dog went from inside to outside or outside to inside. This can be unreliable and result in corrupted records when the dog goes outside through the doggie door but is let inside the house through another means (main door, garage-to-kitchen door, etc.).
A better solution would detect the direction of the initial swing of the door (inside -> outside or outside -> inside) and use that to determine whether the dog went out or came in.
Currently, we use a state variable to determine whether the dog went from inside to outside or outside to inside. This can be unreliable and result in corrupted records when the dog goes outside through the doggie door but is let inside the house through another means (main door, garage-to-kitchen door, etc.).
A better solution would detect the direction of the initial swing of the door (inside -> outside or outside -> inside) and use that to determine whether the dog went out or came in.