Bonjour,
voilà j’essaye de faire un fake switch qui m’inverse l’état en focntion d’un actionneur.
J’essaye de l’intégrer dans le switch.yaml, en vain j’ai toujours une erreur à la vérification.
La première partie de mon code est celle-ci :
***# Fichier switch.yaml***
############################################################
###################### Switch Zibase #######################
############################################################
- platform: template
switches:
spot_entree:
turn_on:
service: rest_command.spot_entree_on
turn_off:
service: rest_command.spot_entree_off
spot_terrasse:
turn_on:
service: rest_command.spot_terrasse_on
turn_off:
service: rest_command.spot_terrasse_off
eclairage_laly:
turn_on:
service: rest_command.eclairage_laly_on
turn_off:
service: rest_command.eclairage_laly_off
volet_cuisine:
turn_on:
service: rest_command.volet_cuisine_on
turn_off:
service: rest_command.volet_cuisine_off
J’ai collé en dessous ça :
- platform: template
switches:
Fil_Pilote:
friendly_name: 'Convecteur : Salle de Bain'
value_template: "{{ is_state('switch.micro_smart_energy_switch_g2_2', 'off') }}" # fake switch is on when real switch reports off, and vice versa
turn_on:
service: switch.turn_off
data:
entity_id: switch.micro_smart_energy_switch_g2_2
turn_off:
service: switch.turn_on
data:
entity_id: switch.micro_smart_energy_switch_g2_2
C’est juste ou faux ? ou est mon erreur ? Si j’enleve la 2eme partie cela fonctionne, pas d’erreur. Si je met la partie « convecteurxxx », j’ai ça comme erreur :
Invalid config for [switch.template]: invalid slug Fil_Pilote (try fil_pilote) for dictionary value @ data[‹ switches ›]. Got OrderedDict([(‹ Fil_Pilote ›, OrderedDict([(‹ friendly_name ›, ‹ Convecteur : Salle de Bain ›), (‹ value_template ›, « {{ is_state(‹ switch.micro_smart_energy_switch_g2_2 ›, ‹ off ›) }} »), (‹ turn_on ›, OrderedDict([(‹ service ›, ‹ switch.turn_off ›), (‹ data ›, OrderedDict([(‹ entity_id ›, ‹ switch.micro_smart_energy_switch_g2_2 ›)]))])), (‹ turn_off ›, OrderedDict([(‹ service ›, ‹ switch.turn_on ›), (‹ data ›, OrderedDict([(‹ entity_id ›, ‹ switch.micro_smart_energy_switch_g2_2 ›)]))]))]))]). (See ?, line ?).