node-red-contrib-home-assistant-websocket icon indicating copy to clipboard operation
node-red-contrib-home-assistant-websocket copied to clipboard

after update ha to 2022.7.x no more actionable notification

Open sanderlv opened this issue 3 years ago • 3 comments

Describe the bug

I was pointed to a breaking change from here https://community.home-assistant.io/t/actionable-notifications-in-node-red/324865/11

Now I am wondering what I need to change where and if anyone has also encountered this breaking change. Any help greatly appreciated since these nodes have been working more than ok since I inserted them over a year or so ago. But now sinnce 10 day no more actionable notifications are coming in anymore...

Thanks for any help 😀

To Reproduce

It might have to do with having the nodes imported longer time afo. But I cannot find any more good i fo on how to proceed. Thus I think for me this has became a bug.

Expected behavior

Like for over a year is should action me via the app.

Screenshots

None

Example Flow

None available

This package's version (not the Home Assistant add-on version)

latest

Is Node-RED running in Docker?

Home Assistant add-on

Node-RED version

12.0.2

Node.js version

latest

Additional context

None

sanderlv avatar Jul 20 '22 16:07 sanderlv

Quick fix seems to be changing title to command in the create service call function node, and also moving the command into the data block.

const actions = [];
[1,2,3].forEach(i => {
    const name = `action${i}`
    const id = flow.get(`${name}Id`);
    const title = env.get(`${name}Title`);
    const uri = env.get(`${name}Uri`);
    const action = !!uri.length ? 'URI' : title ? flow.get(`${name}Id`) : undefined;
    
    actions.push({
        action,
        title,
        uri
    });
});

msg._originalPayload = msg.payload;
flow.set('latestMessage', msg);

const services = env.get('service');
if(!services) {
    node.status({
        text: 'no services defined',
        shape: 'ring',
        fill: 'red'
    });
    return;    
}

services.trim().split(/,\s*/).forEach(service => {
    if(!service) return;
    
    msg.payload = {
        service,
        data: {
            message: env.get('message'),
            data: {
                tag: flow.get('notificationTag'),
                actions,
                color: env.get("color"),
                group: env.get("group"),
                sticky: env.get("sticky"),
                timeout: env.get("timeout"),
                icon: env.get("icon"),
                command: env.get('title')
            }
        }
    };
    node.send(msg);
});

node.done();

Wolbaz avatar Jul 31 '22 14:07 Wolbaz

From the documentation, the command property is only in beta. @me once the app is out of beta, I'll add a new property for command.

zachowj avatar Aug 01 '22 07:08 zachowj

Help, what do I need to change where (as non coder)?

sanderlv avatar Aug 02 '22 11:08 sanderlv

This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 02 '22 07:09 github-actions[bot]