Use Design Pattern: Associated Items to name your window sensor Items, thermostats Items, and target temp Items. Construct the names so you can easily parse and create the name of the associated Items based on the name of an Item you already have.
For example, The Window sensor changes triggering a rule. You parse out the common parts of the Window Sensor Item and construct the name of the associated thermostat and the target temp for when the window is open. Then you can pull the target temp Item from a Group by name and send that number as a command to the thermostat.