Window open, climate off

Thanks for the feedback. I totally agree that there is a need for a functionality like this. Actually, I have tried to get it working, so that the position is stored to a variable if the window is opened. So I added a part in the Blueprint.

variables:
  cover_previous_position: {{ states.cover.living_room_window.attributes.current_position }}

and in the action part:

  - service: cover.set_cover_position
    data_template:
      position: '{{ states(cover_previous_position) }}'

:warning: But it is not possible :warning:

The variable is set correctly but cannot be restored:

Error: Error rendering data template: AttributeError: 'NoneType' object has no attribute 'lower'

Workaround

As I already have tried to explain here - an additional input numbers helper is needed to store the current value of the blind_position Open your Home Assistant instance and show your helper entities.

Create Helper

I named mine input_number.test_2

Use additional actions of the Blueprint to control the cover

:warning: Make sure you have imported the right version from GitHub :warning:
You can directly import the Blueprint directly here:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

I have used in my Example cover.living_room_window

Additional Open Action

  1. In order to set the current position of the blind to the input number use a Call Service action:
service: input_number.set_value
target:
  entity_id: input_number.test_2
data_template:
  value: '{{ state_attr(''cover.living_room_window'', ''current_position'') | int  }}'

  1. Open the Blind

Additional Close Action

  1. Set the cover to the saved position of the input number value use a Call Service action:
service: cover.set_cover_position
data:
  position: '{{ states(''input_number.test_2'') | int  }}'
target:
  entity_id: cover.living_room_window

:partying_face: You are done!

At least for the moment. Additional features like the mentioned sunset, close back after window is closed: Y/N (Yes) and stuff like that are still not part of a KISS climate blueprint (POV)!

ezgif-4-960674f87d

Additional information


Here is the blueprint in YAML

alias: '😎 Window based climate-entity control with cover control'
description: ''
use_blueprint:
  path: SmartLiving-Rocks/window open climate off with optional actions.yaml
  input:
    open_action:
      - service: input_number.set_value
        target:
          entity_id: input_number.test_2
        data_template:
          value: >-
            {{ state_attr('cover.living_room_window', 'current_position') | int 
            }}
      - service: cover.open_cover
        data: {}
        target:
          entity_id: cover.living_room_window
    window_entity: binary_sensor.door_window_sensor_x
    minimum_open_time: 1
    climate_target: climate.hvac
    close_action:
      - service: cover.set_cover_position
        data:
          position: '{{ states(''input_number.test_2'') | int  }}'
        target:
          entity_id: cover.living_room_window