Autocomplete form with serial port

Good day
I would like to know if I can autocomplete the form with information that comes to me from the serial port.
I need that what the serial port generates be automatically filled in the "Internal identification (cafrilosa)" section.
I appreciate your help.



This is my code

[{"id":"bb8219b1.f98808","type":"tab","label":"Ingreso","disabled":false,"info":""},{"id":"1cec7063.11623","type":"mqtt out","z":"bb8219b1.f98808","d":true,"name":"","topic":"cafrilosa","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e822c94a.9b3b88","x":640,"y":40,"wires":[]},{"id":"cc146b0b.c2bfe8","type":"debug","z":"bb8219b1.f98808","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":180,"wires":[]},{"id":"fe1054be.5f36f8","type":"ui_form","z":"bb8219b1.f98808","name":"","label":"","group":"eccfb0b5.c7841","order":3,"width":"6","height":"15","options":[{"label":"Ingrese proveedor","value":"proveedor","type":"text","required":true,"rows":null},{"label":"Identificación Interna (Cafrilosa)","value":"interna","type":"number","required":true,"rows":null},{"label":"Identificación externa (Agrocalidad)","value":"Externa","type":"number","required":true,"rows":null},{"label":"Identificación RFID","value":"RFID","type":"number","required":false,"rows":null},{"label":"Fecha de ingreso","value":"Fecha","type":"date","required":true,"rows":null},{"label":"Hora","value":"Hora","type":"time","required":true,"rows":null}],"formValue":{"proveedor":"","interna":"","Externa":"","RFID":"","Fecha":"","Hora":""},"payload":"","submit":"Enviar","cancel":"Cancelar","topic":"datos","topicType":"msg","splitLayout":false,"className":"","x":90,"y":120,"wires":[["5251578d.c26568"]]},{"id":"5251578d.c26568","type":"moment","z":"bb8219b1.f98808","name":"","topic":"HoraF","input":"payload.Hora","inputType":"msg","inTz":"America/Guayaquil","adjAmount":0,"adjType":"days","adjDir":"add","format":" HH-mm-ss","locale":"es-EC","output":"payload.Hora","outputType":"msg","outTz":"America/Guayaquil","x":250,"y":140,"wires":[["df53c6e6.45d3f8","1cec7063.11623"]]},{"id":"df53c6e6.45d3f8","type":"debug","z":"bb8219b1.f98808","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":100,"wires":[]},{"id":"cee226f9.aacde8","type":"ui_text","z":"bb8219b1.f98808","group":"eccfb0b5.c7841","order":3,"width":0,"height":0,"name":"","label":"Etiqueta RFID","format":"{{msg.payload}}","layout":"row-right","className":"","x":600,"y":260,"wires":[]},{"id":"e386b1a4.731a1","type":"serial in","z":"bb8219b1.f98808","name":"LectorRecepción","serial":"777d4c84.91bdd4","x":100,"y":240,"wires":[["cee226f9.aacde8","cc146b0b.c2bfe8"]]},{"id":"e822c94a.9b3b88","type":"mqtt-broker","name":"","broker":"a2zqappyioofpy-ats.iot.us-east-1.amazonaws.com","port":"8883","tls":"c0281458.6d4ad8","clientid":"","usetls":true,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"eccfb0b5.c7841","type":"ui_group","name":"Balanza","tab":"4cdb26b2.8e1da8","order":1,"disp":false,"width":"6","collapse":false,"className":""},{"id":"777d4c84.91bdd4","type":"serial-port","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"10000"},{"id":"c0281458.6d4ad8","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"390da42f3dae16b3f80d6e0ce4b01d8719401922c2241baca7871d01f2a1d98a-certificate.pem.crt","keyname":"390da42f3dae16b3f80d6e0ce4b01d8719401922c2241baca7871d01f2a1d98a-private.pem.key","caname":"AmazonRootCA1.pem","servername":"","verifyservercert":false},{"id":"4cdb26b2.8e1da8","type":"ui_tab","name":"Ingreso","icon":"dashboard","disabled":false,"hidden":false}]

Hi @Jhontan14, if you select "Text option" on Type on Form Elements, on your "form node" you can set "msg.payload.interna" property into flow variable, i'll show you:
s1
Then you can store/save you value string from SERIAL to a flow variable, then set the property "msg.payload.interna" with a change node:
s22

I simulated serial input with a inject node:
s2

this is the code:

[{"id":"bb8219b1.f98808","type":"tab","label":"Ingreso","disabled":false,"info":""},{"id":"cc146b0b.c2bfe8","type":"debug","z":"bb8219b1.f98808","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":160,"wires":[]},{"id":"fe1054be.5f36f8","type":"ui_form","z":"bb8219b1.f98808","name":"","label":"","group":"eccfb0b5.c7841","order":3,"width":"6","height":"15","options":[{"label":"Ingrese proveedor","value":"proveedor","type":"text","required":true,"rows":null},{"label":"Identificación Interna (Cafrilosa)","value":"interna","type":"text","required":true,"rows":null},{"label":"Identificación externa (Agrocalidad)","value":"Externa","type":"number","required":true,"rows":null},{"label":"Identificación RFID","value":"RFID","type":"number","required":false,"rows":null},{"label":"Fecha de ingreso","value":"Fecha","type":"date","required":true,"rows":null},{"label":"Hora","value":"Hora","type":"time","required":true,"rows":null}],"formValue":{"proveedor":"","interna":"","Externa":"","RFID":"","Fecha":"","Hora":""},"payload":"","submit":"Enviar","cancel":"Cancelar","topic":"datos","topicType":"msg","splitLayout":false,"className":"","x":470,"y":120,"wires":[["b48c4c3e7515913c"]]},{"id":"cee226f9.aacde8","type":"ui_text","z":"bb8219b1.f98808","group":"eccfb0b5.c7841","order":3,"width":0,"height":0,"name":"","label":"Etiqueta RFID","format":"{{msg.payload}}","layout":"row-right","className":"","x":400,"y":240,"wires":[]},{"id":"d3659fcf269122c8","type":"inject","z":"bb8219b1.f98808","name":"SERIAL SIM","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":" 19 101 59 62","payloadType":"str","x":210,"y":220,"wires":[["7c9a995b622c30fa","cee226f9.aacde8"]]},{"id":"b48c4c3e7515913c","type":"debug","z":"bb8219b1.f98808","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":120,"wires":[]},{"id":"7c9a995b622c30fa","type":"change","z":"bb8219b1.f98808","name":"","rules":[{"t":"set","p":"msg","pt":"flow","to":"payload","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.interna","pt":"msg","to":"msg","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":200,"wires":[["cc146b0b.c2bfe8","fe1054be.5f36f8"]]},{"id":"eccfb0b5.c7841","type":"ui_group","name":"Balanza","tab":"4cdb26b2.8e1da8","order":1,"disp":false,"width":"6","collapse":false,"className":""},{"id":"4cdb26b2.8e1da8","type":"ui_tab","name":"Ingreso","icon":"dashboard","disabled":false,"hidden":false}]

i hope it helps you!!

1 Like

Thank you very much it was very helpful ¬°¬°¬°¬°

1 Like

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