This is a strange problem to describe, and the problem (if indeed it is a problem) might lie in node red or HA, but I am starting here so please bear with me…
I have had home assistant running on a pi for a long time, and I have TTS to Alexa working fine, which I use a lot in various automations. I am just starting to play around with node red, and I thought a good exercise to get going with would be to write some general purpose TTS routines that I can pass text to. I can get TTS from node red to alexa devices working fine like this, but I have come across an anomaly in the routine to send TTS to my android phone (via notify.mobile_app_xxx) which has me completely stumped.
I can, for example, pass something like
The temperature is {{ states.sensor.lounge_temperature.state }}
in “payload” to the call service node that invokes notify.alexa_media_last_called, and in that call’s data that looks like
{
"message": "{{payload}}",
"data": {
"type": "tts"
}
}
the message text will be (as I perceive it) iteratively evaluated so that the text in payload gets picked up, and then the sensor state value included in that text substituted in.
But when using the notify.mobile_app_xxx service to send TTS to my phone, which needs data in the call service node looking like
{
"message": "TTS",
"data": {
"tts_text": "{{payload}}",
"ttl": 0,
"priority": "high"
}
}
the text in payload gets pulled in, but that is then not re-interpreted, so my phone actually speaks
"the temperature is states sensor lounge underscore temperature state".
If I set the data to look like
{
"message": "TTS",
"data": {
"tts_text": "The temperature is {{ states.sensor.lounge_temperature.state }}",
"ttl": 0,
"priority": "high"
}
}
it works as expected, so I know states can be pulled in using this service, it just doesn’t seem to do more than 1 “pass” resolving what’s inside any curly braces.
Is this a bug? Am I doing something wrong? Is there a way to force something within curly braces (eg: {{payload}}
) that itself then includes further curly braces to get re-evaluated? Is this handled within node red, or in HA, or in the mobile_app service?