I want to judge the status of the window before opening the cover. If the window is opened, the cover will not be moved, so I added a template cover to replace the actual cover in the UI, but the set position never works. (open and close works well), it says “extra keys not allowed @ data [‘position’]” when set template cover’s position in UI. I think it is a problem of transferring position, The position when the template cover position is clicked should be transferred to the actual cover
HAOS version is 2021.11.4
My code:
cover:
- platform: template
covers:
study_curtain_tpl:
unique_id: study_curtain_tpl
friendly_name: study_curtain_tpl
position_template: "{{ state_attr('cover.study_curtain', 'current_position') | int }}"
open_cover:
- service: automation.trigger
target:
entity_id: automation.study_cover_open
close_cover:
- service: automation.trigger
target:
entity_id: automation.study_cover_close
stop_cover:
- service: cover.stop_cover
target:
entity_id: cover.study_curtain
set_cover_position:
- service: automation.trigger
target:
entity_id: automation.study_cover_pos
data:
position: {{position}}
automation:
- id: study_cover_open
# .......
- id: study_cover_close
# .......
- id: study_cover_pos
alias: study_cover_pos
trigger:
- platform: state
entity_id: input_boolean.test
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.study_window
state: 'off'
sequence:
- service: 'cover.set_cover_position'
target:
entity_id: cover.study_curtain
data:
position: {{position}}
- conditions:
- condition: state
entity_id: input_boolean.study_window
state: 'on'
sequence:
- service: persistent_notification.create
data:
message: 'notify something'
default:
- service: persistent_notification.create
data:
message: 'notify something'