Fire script from Node-RED based on variable

Hi All,

I’m trying to start a HA script from Node_RED where I use a variable to determine which script to start (new_button). new_button is part of the node message and is working fine.

I created this:


The data field looks like this:

{
    "entity_id": "media_media_settings_mode_{{new_button}}"
}

new_button contains the name of the HA script to start. I don’t need any other data fields for the script.

When running no errors are thrown, however Node-RED says: switch_turn_on called at…

I know this way of doing things works for input_booleans, but does not seem to work for scripts, or more likely I’m doing something wrong.

Config: Home assistant core with Node-Red add-on (v7.0.0)

Thanks in advance,

Ralph