Led Node red dashboard doesn't work with string

I am using the nodes in the picture to read from the database a string and control the led according to the value of that string.

In the node fuction I have : "msg.topic="SELECT connected FROM BootNotification WHERE CP_id='CP_1'. To take the string from the database.
In msg.payload I can see the string that I get from database in an array. However, the led doesn´t change the color according the value of the string.
Someone can help me??

you probably need to use a change node to copy the connected value into payload before the LED node (guessing as I dont use it)

show me the config page of the LED node and the value of msg.payload in the debug output.

Hello and thanks for your reply.
How the led is set up:

An the debug of msg.payload:

ok, according to the config page, the LED node expects msg.payload to be "connected" or "disconnected" BUT as you can see, the debug output of the database is an array with 1 element that is an object with a property of connected that holds the value.

So, use the "copy path" button (appears when you hover over item of interest) to grab the actual path of connected and use a change node to move/copy the value into msg.payload

I.E. database node >> change node >> LED node

change node* Set msg.payload to the value of msg.<copied path>

Good...It works.
Thank you

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