Hi
I use a WiiM Pro to stream Roon, Spotify, Bluetooth etc to my audio system (RME ADI-2 Pro FS R, CamillaDSP on RPi5 for convolution, and KEF LS50WII +KC62s) and it sounds great. Transport control works via Node-RED using the WiiM http api, but I also want the system to respond to events on the WiiM. For example, I want to detect if users start to play a track by controlling playback from their mobile, or if the resolution of the next track changes from the previous one. The WiiM is a UPnP device of course, and maybe this protocol offers my best chance.
I've spent some time blundering around on this, and with help from @Valimir on the WiiM forum made a little progress. I found a free app for Android, UPnP Tool, which began to unlock the issue. I've managed to get Node-RED to subscribe to the relevant event service (or at least I think I have) but I'm not managing to get to access those events in Node-RED. I say I think I've subscribed successfully, because WiiM responds with:
My SUBSCRIBE http request includes the necessary CALLBACK header (<http://192.168.11.199:24879>), although there's no explicit confirmation in this response. Perhaps that's the problem.
I found Node-RED as standard can't http listen on a port other than the configurable main web port, but a bespoke node (node-red-contrib-http-custom-port) purports to facilitate this. However, I don't get any event notifications listening on this port, and that's where I'm now stuck.
I’ve read that the http in node needs to be able to handle the NOTIFY verb, which the standard and custom port versions do not - is that an insurmountable barrier? @Valimir has made a suggestion I don’t understand, so I’ll struggle to implement. All suggestions are very welcome.
Ah well, Node-RED’s http in simply can’t accept the NOTIFY verb, and I’m accepting that this is an insurmountable barrier. Meanwhile I’ve got a workaround up and running - simply using Home Assistant’s DNLA service to detect changes in the WiiM playing status, and letting NR know. Works for part of I’m after, and I’ll just have to live with the limitations.
pretty sure you can, anything is possible with node-red, if you try hard enough.
But this is not just http-in, it is UPnP, which makes its announcements over udp.
You could try a udp-in node instead and see what happens.
That's what I thought, but my and others research (see the other posts referenced above) indicates otherwise … unless someone who has actually done it can indicate how to overcome this issue within Node-RED. People writing JavaScript apps to workaround the Node-RED limitations tends to confirm the conclusion
Well again, node-red can do pretty much anything.
As your linked post (the one you don't understand) shows an example - it uses a library:
node-upnp-subscription
This is a library you can use inside a function node.
1 Like
Thanks @bakman2. I'd come across this library, but since my competence extends only to Node-Red and not Node.js ( Differences Between Node.js and Node-RED seemed to me to suggest they are quite distinct) I was unclear how it would solve the limitations I've referred to before. The side js solution previously suggested indicated that the script had to run in a node outside Node-RED in some way, a way that remains unclear to me. Again, if you can enlighten me, feel free to do so - without asking me to suddenly become an experienced JavaScript programmer, rather than a relatively new user of Node-Red!
Node.js is a "JavaScript runtime environment", it's a platform that javascript stuff runs on. For example node red is built on node.js. But node.js is much more than node red, and most people who use node.js doesn't use node red. For example you can make a website with Express.js, which also is built on node.js, but has nothing to do with node red. You could use other programming languages and other environments do to similar or completely different things.