@Olivier974 wrote:
Hello ,
i have a automation with template but i dont succeed to make it work : i have a code to return like this :
file: 01 file: 02 ... file: 19
i send command over serial port of a esp32cam to a DFPlayer mini to play sounds mp3, but for the service “play” a file with this format is needed : file: xx
and this perfect example doesnt work : here my config :
automation :
- id: '1585775492288' alias: son doorbell manuel essai description: '' trigger: - entity_id: input_select.essai_son_doorbell_sounds platform: state condition: [] action: - data: {} service: esphome.essai_son_doorbell_dfplayer_reset - delay: 00:00:01 - data: {} service: esphome.essai_son_doorbell_dfplayer_set_device_tf - delay: 00:00:01 - data: volume: '25' service: esphome.essai_son_doorbell_dfplayer_set_volume - service: esphome.essai_son_doorbell_dfplayer_play data_template: entity_id: input_select.essai_son_doorbell_sounds option: > {% if is_state('input_select.essai_son_doorbell_sounds', '07_souriez') %} file: '07' {%-elif is_state('input_select.essai_son_doorbell_sounds', '08_alex_je_te_vois') %} file: 08 {%-elif is_state('input_select.essai_son_doorbell_sounds', '09_woody') %} file: 09 {% else %} file: 09 {% endif %}
input_select :
essai_doorbell_sounds: name: Sons sonnette en live options: - 07_souriez - 08_alex_je_te_vois - 09_woody - None initial: None icon: mdi:play-circle-outline
I try :
'file: 08' "file: '08'" "{file: '08'}" and : service: esphome.essai_son_doorbell_dfplayer_play data_template: entity_id: > {% if is_state('input_select.essai_son_doorbell_sounds', '07_souriez') %} {file: 09} {%-elif is_state('input_select.essai_son_doorbell_sounds', '08_alex_je_te_vois') %} {file: 09} {%-elif is_state('input_select.essai_son_doorbell_sounds', '09_woody') %} {file: 09} {% else %} {file: 09} {% endif %}
it doesnt work.
i need some help please, too noob to get it working…search for hours…no success
thanks!
Posts: 22
Participants: 3