Node Red function node no longer working

This use to work for me in a function node in Node Red, but no longer gets the state information.

msg.payload =

"The temperature is "+
“{{states.sensor.house_temperature.state}}”
return msg

Please use code tags.

Can you see the sensor state in developer tools → states?

Yes, I can see the sensor state in developer tools → states.

The output is The temperature is {{states.sensor.house_temperature.state}}

It does not place the actual state in the sentence

That’s actually a Jinja2 template, and it would never have been rendered directly in a function node. If you were passing it to a call-service node, then Home Assistant would have processed the Jinja2 template on its side. However, if this was used with a notification service, Home Assistant recently removed the ability for notification services to render Jinja2 templates.

You can achieve similar functionality by using Node-RED to generate the message instead and passing the final text directly to Home Assistant.

I am using the function node with “Amazon Echo Hub” to announce on an echo speaker. This worked fine for years, I just noticed it recently it’s not working but I hadn’t used it for a while.

The equivalent of

{{states.sensor.house_temperature.state}}

in jsonata is

$entities('sensor.house_temperature').state

Thank you for giving the jasonata equivalent but I don’t have much of an idea how to make this work. Can you please explain how I could make this work for what I am trying to do.