Copying my Door control status back to my Mysql databse

Sir I want that only valid entered rfid can trigger the switches and updated data happen only in their columns.

Yes Sir. only that person can use their own dashboards

For e.g i entered E1234562 then i triggered switch then update only E1234562 column
not in E1234561

Yes Sir ,What alternative I can apply so that i can store my open/close string into my database wrt my entered RFID

I am waiting for your reply anyone please suggest me some another method please,as i have to submit my report.

Is this a school assignment?

Its my company project I really have to update them.

So you have been asked to complete this project with no knowledge of Node-RED or SQL?

I will try to explain how you might be able to solve it. I cannot promise this will work because I still don't think you have told use what you really want.

At the moment when a message arrives over MQTT, you are passing it to two separate flows - the 'set msg.id' node, and the 'template' node flow. So you now have two separate messages flowing through.

The first of those messages (the set msg.id branch) will go straight to the update_template node. At that point, the message will have a payload of E1234562 and an id of E1234562, so the SQL statement will be generated with that value in both positions. That is not what you want.

The second of those messages will pass through the flow that checks to see if it exists, then setting payload to the valid/invalid messages. You then, for some reason, pass them to a pair of dashboard switch nodes.

At some point you click the dashboard switch node and it will send its value (the valid/invalid payload) to the update_template node. But at this point, that message no longer has the original RFID id attached to it (msg.id was never set in this branch of the flow), so the SQL statement is not correct.

TO fix it...

  1. delete the set msg.id Change node and its wire going to the update_template node.

  2. add a new Change between the MQTT node and the first template node. Configure that node to set flow.id to msg.payload. Note this is setting the flow context variable. I'm not going to explain what context is - you can go read the documentation.

  3. Add a Change node before the update_template node configured to set msg.id to flow.id - this will copy the last stored value of flow.id back onto the message.

  4. Rewire both of the Dashboard switch nodes so they go into this new Change node.

This node first connects to ?

At the moment you have:

ui_switch -\
            > - Template
ui_switch -/

You want:

ui_switch -\
            > - Change -> Template
ui_switch -/

Sir I am a fresher I have learned Node red in CDAC but i got interest in node red so i opted this project so that i can get more knowledge and learning,and when i saw this forum i really got more interest in Node red .Thats why i am asking no personal intentions to trouble you .
Sorry once again if any line is wrong.

This showing property error

Share a screenshot of how you have configured the node.

It looks like you have a space character after id.

Sir,how can I say thanks i dont know .thank you so much it is now working
Thank You Sir.

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