Closed everything-tech-related closed 5 years ago
It is working fine for me. I tested it using the following flow:
The function node includes the following:
msg.payload = {
"selector": "label:Hall Near Door",
"power": "on"
}
return msg;
If you still can't get it to work, attach a copy of your msg.payload
and I will have a look.
So do you have to manually type "on" in Power section?
All these nodes support static and dynamic behaviour. If you want a node to perform a specific operation on a defined set of globes (eg a node to turn on the power of a specific globe), you can use the Node-Red editor. In this setup, the msg.payload
is just the trigger and need not contain any value.
However if you have logic in your flow to dynamically set values, you can use msg.payload
to send these values to the node.
So do you have to manually type "on" in Power section?
I am interpreting this to mean in the Node-Red editor, and so would be a static definition. The power section supports the values on and off.
:) I'm a bit confused with what you just said. Can you make your reply a bit simpler?
Let me try to explain better. I'm sending a voice command to alexa, "turn on bedroom light"
I can see the mag.payloay "on" But how do I get "on" string to paste inside the Power text input? I tried msg.payload...payLoad...nothing works.
I want to use one state node to turn light on or off.
Forgive me if your above answer is correct. I just don't understand it.
Given you want to use one state node to turn a globe on and off, you need to use msg.payload
. To turn it on, you would need to inject a:
msg.payload = {
"selector": "label:Deveraux",
"power": "on"
}
and off:
msg.payload = {
"selector": "label:Deveraux",
"power": "off"
}
You may need to use a Function node to set msg.payload
.
That said, if you want to use Alexa to control your globes there is native support available (see "LIFX Help Center").
Hi I was able to make it work with a switch node. But I also want to be able to change colors without creating seperate nodes. I have native alexa support for lifx. But I want to use node red to tie everything into a single dashboard. More projects to follow.
Maybe I'm not using the correct format. I can set power to "on or off" however I cant pass a variable with the intended power state. msg.payload doesn't work.