HI,
please help me making a template to display a selected piece of string in the title / message of an automation notification…
this is the automation action:
action:
- service: notify.ios_iphone
data_template:
title: "Activity Speech"
message: "Please listen" (change this into) {{ template for filename bit}}
data:
push:
sound: >
{% if is_state ('input_select.activity','Opstart') %} US-EN-Morgan-Freeman-Welcome-Home.wav
{% elif is_state ('input_select.activity', 'Opstaan') %} US-EN-Morgan-Freeman-Good-Morning.wav
{% elif is_state ('input_select.activity','Aan de slag') %} US-EN-Morgan-Freeman-Turning-On-The-Lights.wav
{% elif is_state ('input_select.activity', 'Home theater') %} US-EN-Morgan-Freeman-Starting-Movie-Mode.wav
{% elif is_state ('input_select.activity','Gym') %} US-EN-Morgan-Freeman-Motion-In-Game-Room.wav
{% elif is_state ('input_select.activity', 'Selamat makan') %} US-EN-Morgan-Freeman-Motion-In-Kitchen.wav
{% elif is_state ('input_select.activity', 'Uit huis') %} US-EN-Morgan-Freeman-Vacate-The-Premises.wav
{% elif is_state ('input_select.activity', 'Naar bed') %} US-EN-Morgan-Freeman-Good-Night.wav
{% endif %}
If activity ‘Aan de slag’ would be selected, I would want ‘Turning on the lights’ to appear in the message. So somehow it would need to:
- select the correct file, (already done by this automation, working fine)
- filter out the ‘US-EN-Morgan-Freeman-’ and ‘.wav’ bits,
- change ‘Turning-On-The-Lights’ into Turning on the lights…
Could this be done? Need some of your better templating skills here…
Cheers,
Marius