Passing notify "entity" to an Action Node

Is there a way to pass notify entities to an Action Node? I’m working on some alarm system code, and want to use a function node to pass the “recipient” to the Action Node (or a different node, if that’ll make it work).

For instance, in the image below, I want to pass in mobile_app_james_iphone via json, if that makes sense…

Thanks!!

You can send a JSON object with the full config of the node. Make sure the box to block input overrides is unchecked in the action node.

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/action.html#input

1 Like

Thanks, that’s exactly what I needed!

1 Like

Well, I’m still stuck. I’m obviously new to this…

In my function node, I have this just for testing:

msg.payload = { "action" : "notify.mobile_app_james_iphone", "message" : "testing 123" }

return msg;

Yet, I get the following error in the action node:

name: “ValidationError”
message: ““action” is not allowed to be empty”
stack: “ValidationError: “action” is not allowed to be empty”

Which seems odd - - - my payload has an “action”, and I think it’s valid json?

Message needs to be in the data section but i believe the block input override is still checked.

{
    "action": "notify.mobile_app_james_iphone",
    "data": {
        "message": "testing 123"
    }
}

If it is unchecked and you still get the error, delete that action node and pull a new one out to the workspace.

1 Like

Here’s the way I do it. Absolutely no claim that is this the best way, or even a good way :slight_smile:

First, I set the message and title (heading) properties I want:


(Note: The variable names (eg “phone_message”) can be anything you want)

This info is passed to an Action Node:

And this is the layout of the Data section of that Action Node:

1 Like

Well, kicking myself, but I figured it out. In my function node, I was setting the payload to a string that represented the json object. I assumed the action node would parse that string.

I instead created a true json object in the function node, and set payload to equal the object. Works perfectly!