HI, finally made it to play local files on my Hassio setup. Or so I thought… they aren’t local in fact, because need the base_url (I am using duckdns.org)
please help me to take out the hardcoded base_url out if this template, Ive tried many options, but can’t find the solution.
sensor:
- platform: template
sensors:
sound_bite:
friendly_name: Sound bite
value_template: >
{% set mapper =
{ 'Alarm clock':'mp3',
'Allo allo':'m4r',
'Bike horn':'mp3',
'Broken glass':'mp3',
'Classic phone':'mp3',
'Confusing voice mail':'mp3',
'Devils laugh':'mp3',
'Goofy':'mp3',
'Grolsch beugel':'m4r',
'Horn of saruman':'m4r',
'I see you':'m4r',
'Mario power':'m4r',
'Mr Bean calling':'mp3',
'Mr Bean excuse me':'mp3',
'Mr Bean Nokia':'mp3',
'Parsifal glocken':'mp3',
'Police siren':'m4r',
'Popipopipopi':'mp3',
'Razor':'mp3',
'Rooster':'mp3',
'Siren':'mp3',
'Truck siren':'mp3' } %}
{% set state = states('input_select.sound_bite') %}
{% set url = 'https://mydomain.duckdns.org:8123' %}
{% set path = '/local/sounds/sound_bites/'%}
{% set sound_bite = state|lower|replace(' ','_') %}
{% set ext = '.' + mapper[state] %}
{{[url,path,sound_bite,ext]|join}}
the template works very nicely, and sounds are playing and now I can use that script in my automation and other sound files just how do I get rid of the base_url