dzaczek
(Dzaczek)
September 11, 2019, 3:50pm
1
Hi
I’m trying configure my custom switch for dafan camera
someone can give me a hint what i’m doing wrong
- platform: template
switches:
pos1:
friendly_name: Przedpokoj3
value_template: >
{% if is_state_attr('cover.dafang_move_left_right', 'current_position', 71) %}
on
{% else %}
off
{% endif %}
turn_on:
service: cover.set_cover_position
data:
entity_id: cover.cam_dafang_move_left_right
position: 71
turn_off:
service: cover.set_cover_position
data:
position: 0
entity_id: cover.cam_dafang_move_left_right
petro
(Petro)
September 11, 2019, 4:32pm
2
value_template should only return true or false.
- platform: template
switches:
pos1:
friendly_name: Przedpokoj3
value_template: "{{ is_state_attr('cover.dafang_move_left_right', 'current_position', 71) }}"
turn_on:
service: cover.set_cover_position
data:
entity_id: cover.cam_dafang_move_left_right
position: 71
turn_off:
service: cover.set_cover_position
data:
position: 0
entity_id: cover.cam_dafang_move_left_right
1 Like
dzaczek
(Dzaczek)
September 11, 2019, 7:45pm
3
petro:
platform: template switches: pos1: friendly_name: Przedpokoj3 value_template: “{{ is_state_attr(‘cover.dafang_move_left_right’, ‘current_position’, 71) }}” turn_on: service: cover.set_cover_position data: entity_id: cover.cam_dafang_move_left_right position: 71 turn_off: service: cover.set_cover_position data: position: 0 entity_id: cover.cam_dafang_move_left_right
I tried with you example but behavior is this same after turn on 3 second and button return to state off and cover value is not changed https://gfycat.com/gracefulbronzebird
petro
(Petro)
September 11, 2019, 11:19pm
4
Does your cover report a position? If the cover position does not equal 71, then it will appear off. That’s what the value template is doing. It’s how the switch gets a state.
dzaczek
(Dzaczek)
September 12, 2019, 4:41am
5
Hi
Cover return position in attribute
So what i should use for set custom cover position.
Thank you for you patience
Br
Dzaczek
dzaczek
(Dzaczek)
September 12, 2019, 10:25am
6
Ok it was my typo mistake . I used wrong cover name . Sorry for for the confusion .