Passing !secrets to shell scripts

So I’ve recently written a shell script to pass a TTS string to the Fully app. For security reasons, and portability, I did not hardcode the host, or password into the script.

So my question is, is there a way to pass !secrets as arguments into the script?

aka: tts_scirpt.sh -h $host -p $pass -m “$message”
where $host and $pass are stored in the secrets.yaml file…

I’d do it via script, something like this:

script:
  tts_script:
    sequence:
      - service: shell_command.tts_script
        data_template:
          host: !secret host
          pass: !secret pass
          message: "whatever you want"

shell_command:
  tts_script: "tts_script.sh -h {{ host }} -p {{ pass }} -m {{ message }}"

Give it a try. That should do the trick.

2 Likes

*tts_script.sh :wink:

I also found it odd, but I just copied from above :wink:

Lol, yay for typos, thanks guys, I’ll give it a shot! Or should I say, shto. :wink:

2 Likes

Why this script not working:

turn_on_action:
  service: media_player.kodi_call_method
  data:
    entity_id: media_player.{{bedroom_kodi_name}}
    method: Addons.ExecuteAddon
    addonid: script.json-cec
    params:
      command: activate

I have in secret.yaml:
bedroom_kodi_name: my_kodi_name

Error: Wrong entity_id

turn_on_action:
  service: media_player.kodi_call_method
  data:
    entity_id: !secret bedroom_kodi_name
    method: Addons.ExecuteAddon
    addonid: script.json-cec
    params:
      command: activate

Secret…

bedroom_kodi_name: media_player.my_kodi_name
1 Like

Thanks @anon43302295.

I will try.

1 Like