Automation: When a window opens, turn down thermostats *in that room*

This is a general concept using templating with the basic on/off climate services. The details of the action section really depends on what type of thermostat/climate device you are using. If you need more specific actions such as setting temperature and mode you will probably need to use a Choose action to save and restore the settings.

trigger:
  - platform: state
    to: 
      - 'on'
      - 'off'
    entity_id: 
      - binary_sensor.window_1
      - binary_sensor.window_2
      - binary_sensor.window_3
condition: []
action:
  - variables:
      area: "{{ area_name(trigger.entity_id) }}"
      targets: >
        {{ expand(area_entities(area))
        | selectattr('domain','eq','climate')
        | map(attribute='entity_id') | join  }}
  - service: climate.turn_{{ iif( trigger.to_state.state == 'on', 'off', 'on') }}
    target:
      entity_id: "{{ targets }}"

One relatively easy way to save and recall the settings of a device like a thermostat is to use the scene.create service.

Area-based Example with Scene creation
trigger:
  - platform: state
    to: 
      - 'on'
      - 'off'
    entity_id: 
      - binary_sensor.window_1
      - binary_sensor.window_2
      - binary_sensor.window_3_and_door_1
condition: []
action:
  - variables:
      area: "{{ area_name(trigger.entity_id) }}"
      targets: >
        {{ expand(area_entities(area))
        | selectattr('domain','eq','climate')
        | map(attribute='entity_id') | join  }}
  - choose:
    - conditions:
        - condition: template
          value_template: "{{ trigger.to_state.state == 'on' }}"
      sequence:
        - service: scene.create
          data:
            scene_id: thermostat_settings_{{area}}
            snapshot_entities: '{{ targets }}' 
        - delay: 5
        - service: climate.turn_off
          target:
            entity_id: "{{ targets }}"
    - conditions:
        - condition: template
          value_template: "{{ trigger.to_state.state == 'off' }}"
      sequence:
        - service: scene.turn_on
          target:
            entity_id: scene.thermostat_settings_{{area}}

Things to keep in mind:

  1. These ad hoc scenes do not survive restart, so you may need to create additional options within the Choose action to handle those situations.
  2. In rooms with more than one window and/or door entity being monitored it would be best to create a binary sensor group of those entities and put that in the trigger instead of the individual sensors. If you use the individual sensors you will need to filter out triggers caused by a second window being opened when one is already open. Otherwise, you will overwrite the scene that saved your original settings.