I’ve built almost my entire automation system with HA using node-red, mainly for the simplicity of adding new automations, editing existing and testing new things.
But I’ve stuck on how i should call the google.tts service to be able to read sensor states. Normal text works perfectly.
A regular automation for google.tts with templating looks like this
service: tts.google_say
data_template:
message: "Temperature is {{states('sensor.temperature')}}."
cache: false
But the default call-service within node-red uses regular “data” as the action, so passing the above “message” would result in the media player readin out “states sensor temperature”, not the actual value since it cant understand it’s a template message.
Does anyone know how to do this in a simple way? Or a hard way
Currently, you’re not able to reference states from within the call-service node but you can call a current-state node before it and then use its payload in the call-service node.
{"message": "Temperature is {{payload}}."}
and then make sure you check the Render templates in Data