Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Node-RED
  4. "Sketch Version" (I_SKETCH_VERSION) Handler

"Sketch Version" (I_SKETCH_VERSION) Handler

Scheduled Pinned Locked Moved Node-RED
1 Posts 1 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • crankyC Offline
    crankyC Offline
    cranky
    wrote on last edited by
    #1

    I extended the /root/leases.file to also include a 3rd field for version. Now you can update nodes and see the version change as you update (or view unupdated ones).

    It is functionally very similar to that of I_SKETCH_NAME handler.

    [{"id":"8e3e8f02.7fd0c","type":"mqtt-broker","z":"63842e72.893f78","broker":"localhost","port":"8883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"21742d0e.25817a","type":"mqtt in","z":"63842e72.893f78","name":"Rename sensor in file","topic":"MySensors/+/255/3/0/12","broker":"8e3e8f02.7fd0c","x":106,"y":630,"wires":[["8a1e6bb3.db726"]]},{"id":"8a1e6bb3.db726","type":"function","z":"63842e72.893f78","name":"message to edit","func":"var splitTopic= msg.topic.split(\"\\/\");\nmsg.payload = msg.payload.replace(\"\\n\", \"\");\nmsg.edit = {col1:splitTopic[1] , col3:msg.payload}; \n// msg.edit carries over the next 2 nodes to \"find edit and replace\" function node\nreturn msg;","outputs":1,"noerr":0,"x":352,"y":629,"wires":[["cb5f1a37.6ab65"]]},{"id":"cb5f1a37.6ab65","type":"file in","z":"63842e72.893f78","name":"","filename":"/root/leases.file","format":"utf8","x":528,"y":630,"wires":[["77038207.b61144"]]},{"id":"77038207.b61144","type":"csv","z":"63842e72.893f78","name":"","sep":",","hdrin":"","hdrout":"","multi":"mult","ret":"\\n","temp":"col1,col2,col3","x":113,"y":701,"wires":[["f2858e20.0e9b18"]]},{"id":"f2858e20.0e9b18","type":"function","z":"63842e72.893f78","name":"find edit and replace","func":"for(var i = 0; i < msg.payload.length; i++){\n    if( msg.edit.col1 == msg.payload[i].col1 ){\n        msg.payload[i].col3 = msg.edit.col3;\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":282,"y":701,"wires":[["2ef32bcf.fefb74"]]},{"id":"321725f3.9ad162","type":"file","z":"63842e72.893f78","name":"","filename":"/root/leases.file","appendNewline":true,"createDir":false,"overwriteFile":"true","x":644,"y":702,"wires":[]},{"id":"6404769b.fdaff8","type":"debug","z":"63842e72.893f78","name":"","active":true,"console":"false","complete":"false","x":634,"y":741,"wires":[]},{"id":"2ef32bcf.fefb74","type":"csv","z":"63842e72.893f78","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"col1,col2,col3","x":449,"y":701,"wires":[["321725f3.9ad162","6404769b.fdaff8"]]},{"id":"aaea7f9c.a0adf","type":"comment","z":"63842e72.893f78","name":"I_SKETCH_VERSION handler ([0-255];255;3;0;12;[name])","info":"Whenever a sensor announces itself to the network as [any];255;3;0;11;[name from presentation],\nit modifies field 2 for that appropriate sensor. \n\nThe resulting modification is then saved.","x":304,"y":743,"wires":[]}]
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    22

    Online

    11.7k

    Users

    11.2k

    Topics

    113.1k

    Posts


    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • MySensors
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular