Logical OR within mustache expression within data

Within the JSON portion (or "Data" field), you can obviously make use of a {{variable}} substitution. In my case, I'd like to reference msg.media_player, unless it's not set, then default to flow.media_player.

Obviously, I can add a node in front to handle that logic, but hoping to avoid the extra clutter. Most interpolation implementations offer this feature, so thinking Node-red has it ?

-Chad

Call service node is a non standard HA node. So I dont have it installed. What other input options are there , does it have JSONata, or just string, number, json.

JSON and JSONata

Then use JSONata.
when i get home i'll post an example

That's nice of you. I'm experimenting now, might be onto something

{
    "test": (payload  ? payload : 1)
}

here a simple example.
If msg payload exists and not null, or default 1

Success ! Thanks for the tip.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.