Trying to Switch on payload.settings.id

I'm trying set up a switch node to switch on the payload.settings.id without success. Here's the message from debug:

object
action: "org.tynsoe.streamdeck.wsproxy.proxy-ms"
context: "96DB827800309F7A70FA1BAFEE533B50"
device: "8FF7DE8B17F078F2BD537F99F7BC56F6"
event: "keyUp"
payload: object
  coordinates: object
  isInMultiAction: false
  settings: object
    id: "buttonblue"
    remoteServer: "ws://10.0.0.185:1880/ws/streamdeck"
  state: 1

In node-red, I hovered over the id field and selected the copy path option. I then pasted it into the Property field of the switch node. The drop down selection is set to "msg.". The paste inserted "payload.payload.settings.id".
The test is == and the value is buttonblue

The output of the node is to a debug node. I never see any output from that node. I've also tried "payload.settings.id", "settings.id", and just "id. None work.

I have another switch statement that tests a different field ("event"). It works fine. The switch test is down stream from "websocket in" and "sd input". The latter handles input from a Streamdeck. I couldn't find any examples on the web for the specific field. I'm sure it's a stupid user error.

Did you have "a/z" string mode?

Did you add quotes? (They are not needed)

Are you certain there is no additional whitespace or non printing characters in the string (e.g. a newline or carriage return)

Show us a screen shot of the debug & a screenshot of the switch node.

Ps, when copying the payload value, use the "copy value" button.

I used az, I didn't use quotes, and there is no white space.

The switch node:

The debug output:

I added a new switch statement to test the state. The link was set to payload.payload.state. It works.

Try Property: msg.payload.settings.id rather than msg.payload.payload.settings.id

The debug out certainly seems to show that your path is correct (with the double payload fields).

So if you are not seeing any output from the downstream debug node, I have to ask -- is the tab on the side pushed in (deactivated) or pulled out (active)? Which, if any, of the 3 output checkboxes (debug window, console, and node status) are checked? Is the source end of the wire connected to the switch port 1, or might the wire be routed "behind" the switch node (very unlikely)?

Assuming all of those are set correctly, the only other thing I can think of is that an exception is occurring -- but you would see that in the debug sidebar instead. Maybe try a catch node?

Ok, I'll ask the $100 question.

Why msg.payload.payload?

I need to read a bit more on the picture. Sorry.

Looking at the debug output it certainly looks like it should be msg.payload.payload.settings.id
Configure the Switch with an Otherwise output, connect two (named) debug nodes to the outputs and show us what you see. If it sends it to the wrong output then possibly there are unprintable characters in the string. Feed it into a Function node containing
node.warn(id length: ${msg.payload.payload.settings.id.length}) return msg`
and see what you get in the debug pane.

Now it works. I'm pretty sure @shrickus had it right about the debug node being deactivated. I cut and pasted the debug node and must not have noticed it was deactivated. So, yes, it was a stupid user error. My apologies for wasting your time.

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