Hello guys. I tried setting my blinds to open every morning and close every evening. I want to open it slowly in the morning from 0% to 100% for 30 minutes or more and close it the same way in the evening. I have read all the documents and forums and don’t see anyone mentioning this problem. this topic. I’m not someone who knows how to code. I just get ideas from other people. Can someone help me? Thank you guys so much.
tro_ly_dieu_khien_rem_phong_ngu:
alias: trợ lý điều khiển rèm phòng ngủ
icon: "mdi:bed-king-outline"
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ include_off_covers }}'
sequence:
- service: cover.open_cover
data:
entity_id: '{{ cover.phong_ngu_tang_2 }}'
position: '{{ current_position }}'
- conditions:
- condition: not
conditions:
- condition: template
value_template: '{{ include_off_covers }}'
sequence:
- service: cover.set_cover_position
data:
entity_id: >
{% set cover_positions =
expand(state_attr(cover.phong_ngu_tang_2, 'entity_id'))|
map(attribute='entity_id')|list %} {% set on_covers =
expand(state_attr(cover.phong_ngu_tang_2, 'entity_id'))|
selectattr('state','eq','on')|map(attribute='entity_id')|list %}
{% if (all_covers | length ) > 0 %} {{on_covers}} {% elif
is_state(cover.phong_ngu_tang_2,'on') %} {{
cover.phong_ngu_tang_2 }} {% endif %}
position: >
{{current_position}}
default: []
- repeat:
count: '{{ (positions_min*(minutes | int))+1 }}'
sequence:
- service: cover.set_cover_position
data:
entity_id: >
{% set cover_positions = expand(state_attr(cover.phong_ngu_tang_2,
'entity_id'))| map(attribute='entity_id')|list %} {% set on_covers
= expand(state_attr(cover.phong_ngu_tang_2, 'entity_id'))|
selectattr('state','eq','on')|map(attribute='entity_id')|list %}
{% if (all_covers | length ) > 0 %} {{on_covers}} {% elif
is_state(cover.phong_ngu_tang_2,'on') %} {{
cover.phong_ngu_tang_2 }} {% endif %}
position: >-
{{
((((end_positions|int)-(start_positions|int))/(positions_min*(minutes
|int)) * (repeat.index - 1)) + start_positions | int) }}
- delay:
seconds: '{{ 60/positions_min | int }}'
mode: restart
max: 100
icon: mdi:blinds
description: Fades up or down a single cover or cover group
fields:
minutes:
name: Minutes
description: How long to fade
default: 60
required: true
selector:
number:
min: 1
max: 60
step: 1
unit_of_measurement: minutes
mode: slider
positions_min:
name: Positions per minute
description: How many positions per minute
default: 2
required: true
selector:
number:
min: 2
max: 6
step: 2
unit_of_measurement: times
mode: slider
start_positions:
name: Start Positions
description: Where to start
default: 20
required: true
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: positions
mode: slider
end_positions:
name: End positions
description: Where to end
default: 100
required: true
selector:
number:
min: 0
max: 100
step: 1
unit_of_measurement: positions
mode: slider
single_cover_or_cover_group:
name: Single Cover or Cover Group
description: Entity Cover
required: true
selector:
entity:
domain: cover
include_off_covers:
name: Include off covers
description: Boolean - include off covers.
required: true
default: false
selector:
boolean: null