Door Notification only Uses one of the friendly names

Just setup this Flow to Notify me of doors being opened and closed through new android app.

Notifications work find but the function node i am using to format the message only seems to send Front Door. This is what I am using in the function node.

const friendlyName = msg.data.new_state.attributes.friendly_name;
node.status({text: friendlyName});
return {
        "payload": {
           "data": {
               "message": friendlyName + " was opened"
           } 
    }
};


I am sure there is something simple I am missing.

Why don’t you put a debug node on each event state node to see what’s coming out.

Looks ok to me btw.

I am not a big fan of function node (because I can’t :slight_smile:), I find the change node much more easy. you can replace the function node with this one…

This is the issue. In node.js, consts are block-scoped and once set cannot be changed or redeclared. Change const to var and your function should work properly.

Thanks for the responses guys both of these fixes worked great. Now just need to set it up to only do it when the house is set to away.

Again thanks for all the help.

1 Like