False or true for an LED Display

Good morning everyone,

I get the following back from a node

{{msg.payload[“000106xxx803”].state.remoteEnable.fullRemoteControl}}

if I enter this therm in a text field, a false or true is also returned
I would also like to display an LED display on the page with the result.
For this I have created a function with the

code:
var new = { payload: msg.payload[“000106xxx803”].state.remoteEnable.fullRemoteControl };
return [new];

Unfortunately, this does not return false or true.
How do I have to do this correctly to get the result I want?

Thanks in advance
Greetings
Roland

Can you connect a debug to the node and set the debug node to show complete message object. Then show the expanded debug so we can verify the content of the property.

Please also verify the dashboard you are using and what led node.

Also, assuming that this is in a function node, you need to return a message, not a simple value, so possibly you need something like

msg.payload = msg.payload[“000106xxx803”].state.remoteEnable.fullRemoteControl
return msg

Also note that, when needed, it is better to use const or let rather than var. Also semi colons are generally not required.

I don't think you can use 'new' as a variable name, as it is a reserved JS token. It will throw a runtime error.

1 Like

Hello
and thanks for the feedback

Then I will try to clear up the ambiguities
I am using the flow from:

here, the message of the debug node.
This is where the Boolean values arrive.

The path for this is

payload[“000106xxx803”].state.remoteEnable.fullRemoteControl

If I enter this in a TextField, a boolen value is also returned!

even if I enter the term in the debug node like this
a boolean value is returned

payload["000106xxx803"].state.remoteEnable.fullRemoteControl

What / How do I have to do so that I can control an LED with it?

If I insert the function like this

the message comes back

msg.payload["000106xxx803"].state.remoteEnable.fullRemoteControl : undefined

I hope you understand me better now

Roland

As it should, as you have rewritten msg.payload to boolean true, therefore msg.payload["000106xxx803"].state.remoteEnable.fullRemoteControldoes not exist any more. set the debug after the function to complete messgae object

For the sake of completeness
I have solved it like this and I think it works

var msgNeu1 = { payload: msg.payload["000106xxx803"].state.remoteEnable.fullRemoteControl };
return msgNeu1;

Thank you all!
Roland