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) }}'
But it is not possible
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
Create Helper
I named mine input_number.test_2
Use additional actions of the Blueprint to control the cover
Make sure you have imported the right version from GitHub
You can directly import the Blueprint directly here:
I have used in my Example cover.living_room_window
Additional Open Action
- 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 }}'
- Open the Blind
Additional Close Action
- 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
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)!
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