I have been trying to configure a switch for window covers and got it working but I need the “value_template” for state feedback to be delayed for some time.
Currently I identified the positions are as follows:
100 = cover fully open = switch state off
28 = cover closed = switch state on
I would like the switch button to be delayed enough when its being turned on or off until it reaches its final position.
The current implementation below works fine but for example when the covers are position 100 the switch is “off”, if I turn it on the covers position will slowly go from 100 to 28 and during that time the switch state goes back to off until the covers reach position 28.
I dabbled with “if/else” statements but couldn’t articulate the logic, I also tried static value for the sensor, using is_state_attr instead of state_attr but I am stuck.
Any ideas would help greatly, thank you.
Switch is below:
switches:
lr_cover:
value_template: "{{ state_attr('cover.lr_window_cover', 'current_position') < 29 }}"
turn_on:
- service: cover.set_cover_position
target:
entity_id: cover.lr_window_cover
data:
position: 28
turn_off:
- service: cover.open_cover
target:
entity_id: cover.lr_window_cover
Entity information
friendly_name: LR Window Cover
supported_features: 15
device_class: shade