Greenhouse window opening

Window opening
My greenhouse open these windows 12 sec. Arduino switch on if temp is +20C and motor working 12 sec for full opening. Closing these windows if temp is +19C. For motor i use car window wiper motor.

My new idea is : sample. If temp is +20C motor open window is half only. If temp is +22C motor open window for full position. And close if T is +21 half close and +19 C full close. How Raspberry knows where is window. What position. Reed switch + magnet?
And if rain, window need set to position half closed.
Sry my english.