Mustache templates for entity id work in call service node but not server state changed node?

You could try using environment variables. I use them for nodes that require lat and lon.

https://nodered.org/docs/user-guide/environment-variables