The hat machine is capable of placing a hat on your head as you walk out the door. A successful version would be able to detect and lock onto your head as a target, and use some sort of ceiling-mounted rig to deposit the hat in the correct orientation onto your head as you walk towards the door.
Alternatively, a machine that looks like a bottle capper could be affixed to a stationary point in your house, where you stand inside and it sticks a hat on you- this would be extra funny if the hat resembled a bottle cap.