NodeRed Spotify control

Hi everyone, I'm having some questions about NodeRed. So basically I'm sending over the Spotify song name to a broker called HiveMQ. The goal is to then get it sent over to an ESP32 and get it printed on an LCD screen. The problem is that it is getting sent over to the broker every 4 seconds. However I only want it to inject when the song changes to a new one. Otherwise it keeps getting sent over and it gets printed like 20 times or so on my LCD screen which does not look good.

I was thinking of using an if statement that if soon as the song changes to a new one, it would get injected (and not every 4 seconds). I will attach an image of a part of my code aswell. You can see at the very start I have an inject node. So there I would add a function but I'm not sure how to code this or make it work. Any help would be greatly appreciated. Thanks in advance!

Why not use a filter/rbe node, you could have it set to pass the text message to screen only when it changes.

I'm new to NodeRed so I haven't heard about that yet. Where would I attach this Node to?

The rbe/filter would go just before the node that sends the display text to the LCD.

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