Clipboard

Home Forums General Clipboard

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #22121
    tom deprez
    Participant

    Bonjour,
    Voila mon supporte technique ma donné un fichier à rentrer dans Node-RED ‘Clipboard’ mon problème est que quand je rentre mon texte dans Clipboard un contour rouge s’affiche. j’ai donc essayé de rentrer nœud par nœud et j’ai réussi, sauf le nœud Fonction. il y a surement une erreur mais la quel ? je vous donne la fonction :

    {"id":"67ac197.ec430e8","type":"function","name":"formatage payload","func":"//recuperation du timestamp\nvar tmsp=new Date(msg.timestamp).getTime()-7200000 ;\n\nvar payload_=\"\";\nvar hex_value=0;\nfor(var i= 0; i <msg.payload.length; i++)\n{   \n    hex_value=msg.payload[i].toString(16);\n    if (hex_value.length==1)\n    {\n        hex_value=\"0\"+hex_value;\n    }\n    payload_+=hex_value;\n}\n\nmsg.payload=msg.eui.toUpperCase()+\";\"+tmsp+\";\"+payload_+\";\"+msg.lsnr+\";\"+msg.rssi;\nreturn msg; ","outputs":1,"noerr":0,"x":437.00001525878906,"y":310.20001220703125,"z":"52e7d611.dcfbf8","wires":[["e2597a9b.9d5b78","14ed99db.939bf
     6"]]}
    • This topic was modified 6 years, 4 months ago by tom deprez.
    #22125
    Jason Reiss
    Keymaster

    Is there a newline in the string at the end?

    I’d go back to the support person who gave you this for help to be sure the logic is intact after modifications.

    #22126
    tom deprez
    Participant

    voici toutes les lignes dans la chaîne.

    [{"id":"5510b172.9c35d8","type":"lora in","name":"","datatype":"bytes","x":253,"y":309.1999969482422,"z":"52e7d611.dcfbf8","wires":[["67ac197.ec430e8"]]},{"id":"89a675dd.8c1ed","type":"debug","name":"CALLBACK RESPONSE","active":true,"console":"false","complete":"true","x":886.199951171875,"y":311.20001220703125,"z":"52e7d611.dcfbf8","wires":[]},{"id":"67ac197.ec430e8","type":"function","name":"formatage payload","func":"//recuperation du timestamp\nvar tmsp=new Date(msg.timestamp).getTime()-7200000 ;\n\nvar payload_=\"\";\nvar hex_value=0;\nfor(var i= 0; i <msg.payload.length; i++)\n{   \n    hex_value=msg.payload[i].toString(16);\n    if (hex_value.length==1)\n    {\n        hex_value=\"0\"+hex_value;\n    }\n    payload_+=hex_value;\n}\n\nmsg.payload=msg.eui.toUpperCase()+\";\"+tmsp+\";\"+payload_+\";\"+msg.lsnr+\";\"+msg.rssi;\nreturn msg; ","outputs":1,"noerr":0,"x":437.00001525878906,"y":310.20001220703125,"z":"52e7d611.dcfbf8","wires":[["e2597a9b.9d5b78","14ed99db.939bf
     6"]]},{"id":"e2597a9b.9d5b78","type":"http request","name":"CallBack","method":"POST","ret":"txt","url":"http://91.235.138.86:3333/deviceCallBackManagor/loadMessageMULTITECH","x":648.7999877929688,"y":312,"z":"52e7d611.dcfbf8","wires":[["89a675dd.8c1ed"]]},{"id":"14ed99db.939bf6","type":"debug","name":"","active":true,"console":"false","complete":"false","x":655,"y":216,"z":"52e7d611.dcfbf8","wires":[]}]
    #22129
    Jason Reiss
    Keymaster

    The input must be valid json, try running it through a linter.
    https://jsonlint.com

    #22130
    tom deprez
    Participant

    merci bien 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.