how to read the state of ui-switch in node red .I want to store the message whenever someone toggle the switch and then i have to pass some messg to mqtt out node
I edited your post to so it would display normally instead of looking like shouting)
What have you tried so far? Have you connected a
debug node (set to display the Complete msg object) to the outpput of the
u-switch to see what it is returning.
Where do you intend to store the output?
what kind of message? if it is not in msg.payload, then you will need another node (maybe a
change node) to create the message you want to pass,
Yes Sir I have deployed it
This thing i dont know .Like I want to send my open message back to mqtt out when someone really has toggled that open switch
Yes I have used the change node .
So you will need to test the output of the
ui-switch node. Which of the core nodes do you think you could use for that purpose?
Debug node for checking the output?
is that your answer to my question of how you can test the output? If so, have you noticed that the debug node is a dead end node (i.e. it doesn't have an output)
Go back and look at the core nodes again (I provided you a link to them) and try again.
You tell me. How would you use it?
if open switch has string on clicking =DR1_ON then send messge to my mqtt out
Does it work?
yes debug node i have deployed it is sending me DR1_ON whenever i am clicking that
Let me rephrase my query to you.
You have a msg coming from the
ui-switch node. The msg contains information you need to test to see if it should be sent to the
mqtt-out node so you have
ui-switch ------> ????? -------> mqtt-out
What do you need to put in the middle (where the ?????? marks are) in order to text the contents of the msg and determine if you should send the msg on?
Sir,i know you want me to know ,but according to what i have done is
UI-Switch----->Switch(checked if contains DR1_ON) then trriger my own message --> change node(for my own messge)--> MQTT Out
And does it work? If so, congratulations you have figured out how to solve your problem.
Sir ,The half issue is solved but like i will explain in steps:
1: in this code i have switch case for user like case1: if that ui switch is in real triggered (means Open )then publish message (my own mesg) to mqtt out node
2: similarly for Close ui switch
I'm sorry but I do not understand what you just said.
1 - If you still have an issue export your flow and attach it to a reply.
2 - Then, please explain in more detail what your current issue is
Note: I will be going out for about 2 hours and will respond when I get back.
I have 2 ui switches (open and close) ,
I have a mqtt code in which i am entering one valid rfid person he will have priveldges to use that ui switches
Now I have to send one user defined message to one topic throught mqtt out
and that i am doing by switch case in my mqtt code.(That cases should only work/publish on topic when in real/live that rfid person has pushes that Switches(either open or close)
Case1:publish user defined mesg on one topic(for open)
Case2: similarly for close
where is the export of your flow? (the first thing I asked for)