#How can I make phone TTS optinal ?

1 messages · Page 1 of 1 (latest)

celest iris
#

Hello,
I would like to make phone TTS notifications optional in my blueprint. Is there a way to remove "tts_text" from action arguments if an input was set to false ?

I've tried making the value to "" or false but a tts is played on my phone, asking for a value
And I know that I could simply use an if and have two services with the same content except the tts, but since I have a lot of notification calls in my blueprint, it would feel quite bloated...

Here is the code example :

- action: notify.mobile_app_<your_device_id_here>
  data:
    message: TTS
    data:
      ttl: 0
      priority: high
      media_stream: alarm_stream
      tts_text: "How to remove this line if an input is set to false ??"

Thanks for reading !

raven gust
#

Put the (notify.mobile_app) action in a choose with the conditionif an input was set to false

celest iris
#

I had thought about this but like I said, I would have twice as much notify actions (first one for tts, second without tts) and my code will be quite bloated.
It would be cool to have a way to make a template inside an action to add data only on some conditions.
If I don't find anything else I'll simply use a choose as you suggesged

raven gust
#

@celest iris

#

Or you can 'store' an action as a variable and re-use it I believe.
The whole idea of a blueprint is if it's complicated, so what. You do the blueprint part once and just re-use it by frrding variables.

celest iris
celest iris
raven gust
#

Nothing specific but if you have to repeat code, it works a treat.

#

You can repeat a whole action call and just have to rewrite the lines that are different basically.

celest iris
#

I see...

#

I'll have to look at the wiki for further explainations on how it works

#

thanks for the help !