bonjour,
je suis entrain de créer des template cover et pour mon script cover.set_position j’aimerai pour récupérer le l’id du cover pour qu’il soit compatible à tous mes covers.
- platform: template
covers:
volet_salle_cuisine_gauche:
device_class: shutter
friendly_name: "Volet gauche"
unique_id: cover.volet_salle_cuisine_gauche
open_cover:
service: rfplayer.send_command
data:
command: "ON"
protocol: RTS
device_address: A1
close_cover:
service: rfplayer.send_command
data:
command: "OFF"
protocol: RTS
device_address: A1
stop_cover:
service: rfplayer.send_command
data:
command: "DIM %4"
protocol: RTS
device_address: A1
set_cover_position:
service: script.cover_position
data_template:
position: "{{ position }}"
open_cover_template: 31 # temp d'ouverture
close_cover_template: 30 # temp fermeture
service_cover: rfplayer.send_command
command_open: "ON"
command_close: "OFF"
command_stop: "DIM %4"
protocol_com: RTS
device_address_protocol: A1
entity: "{{ entity_id }}"
cover_position:
sequence:
- service: persistent_notification.create
data:
message: "{{ entity }}"
title: "Le Déclencheur du Script :"
- variables:
courante_position: '{{ state_attr("cover." ~entity , "current_position") | int }}'
cover_position_sec: >-
{% if ( courante_position - position ) > 0 %}
{{ (( courante_position - position ) * close_cover_template / 100 ) }}
{% else %}
{{ (( courante_position - position ) * open_cover_template / 100 ) }}
{% endif %}
- service: rfplayer.send_command
data:
command: >-
{% if cover_position_sec > 0 %}
{{ command_close }}
{% else %}
{{ command_open }}
{% endif %}
protocol: '{{ protocol_com }}'
device_address: '{{ device_address_protocol }}'
- delay:
seconds: >-
{% if cover_position_sec > 0 %}
{{ cover_position_sec }}
{% else %}
{{ cover_position_sec * -1 }}
{% endif %}
- service: rfplayer.send_command
data:
command: '{{ command_stop }}'
protocol: '{{ protocol_com }}'
device_address: '{{ device_address_protocol }}'
Je débute, il y a surement moyen d’optimiser, pour le moment s’est un test.
Je souhaiterai récupérer cover.volet_salle_cuisine_gauche
pour l’envoyer au script.
Merci pour votre aide