Looking for a text

I know it is something really basic that I'm missing here. So I am getting Pushbullet notifications from my phone to NodeRed. I'm looking for any particular notification with a msg.payload that contains a specific set of words. However the switch node is not picking up what is on the message payload.
Here's the debug node:

Test Notification : msg.payload : string[34]
"This is a test message from Sonarr"

But my switch node that is set to look for msg.payload containing "This is a test" is not picking it up, because of the msg topic (Test Notification?).
How do I get the switch node to ignore Test Notification topic and just look for what is in the payload?

No, I don't think that matters, not if you set up the switch node properly to compare with msg.payload

"This is a test" does NOT equal "This is a test message from Sonarr"

How have you set up your switch node?

Using the CONTAINS operator.
It works if I send a regular msg.payload with "This is a test message from Sonarr".

msg.payload : string[14]

"This is a test"

I have also tried passing the exact string. Still not picking it up.

With what? An inject or whatever else you intend to use?

Perhaps posting your flow and all relevant details of your setup will help with the guessing.

Sorry, here's the complete flow. Basically, if it Pushbullet node passes certain words, then turn on a plug.

[{"id":"8051e16e9df394f7","type":"pushbullet in","z":"5d927566.e0570c","config":"3525cc1a.fba694","name":"","x":340,"y":3920,"wires":[["2667aa39f8ea1662"]]},{"id":"099f817b78d0d421","type":"change","z":"5d927566.e0570c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":3920,"wires":[["7323a79da3e0b3bb"]]},{"id":"2667aa39f8ea1662","type":"switch","z":"5d927566.e0570c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"This is a test message from Sonarr","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":480,"y":3920,"wires":[["099f817b78d0d421"]]},{"id":"7323a79da3e0b3bb","type":"kasa","z":"5d927566.e0570c","name":"Alert - KP115(AU)","device":"192.168.68.204","interval":60000,"eventInterval":15000,"payload":"getInfo","payloadType":"info","debug":false,"x":860,"y":3920,"wires":[[]]},{"id":"3525cc1a.fba694","type":"pushbullet-config","name":"mversion"}]

Can't test that... :stuck_out_tongue:

Perhaps setup some debugging to see exactly what comes in and where it goes

On that note... why only one option in the switch node? Harder to track what it is or isn't doing without some alternative choices.

Oh my god... at the end, it was the CHANGE node and the KASA node. I had a change node to set the msg.payload to TRUE. But it looks like I had to also set the msg.topic to blank too before the KASA node would accept the input.

That was really doing my head in.

Thanks for encouraging me to debug every step of the way.

Basically, my kids are into anime and each week they have to wait for the dubbed version of their favourite show. I've setup a special light that when lit up alerts them a new dubbed episode is now available. So my Sonarr setup sends a notification to my phone when a new episode is grabbed. And Pushbullet will send every notification my phone gets to Nodered.

I know there would be other ways to achieve this, but I thought considering Pushbullet has access to EVERY notification on my phone I could use it for other stuff as well.

4 Likes

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