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 Config" (I_CONFIG) Handler

"Sketch Config" (I_CONFIG) Handler

Scheduled Pinned Locked Moved Node-RED
3 Posts 2 Posters 1.9k Views 1 Watching
  • 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

    This flow takes care of the challenge/response for when a sensor asks what config to use (Metric or imperial).

    By default, the code returns M for metric. I don't believe Imperial is used anywhere, but it can be changed to I... if you support it in your code. (Honestly, no clue, but some sketches do make use of the call getConfig() .)

    [{"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":"57ad0c01.895c9c","type":"mqtt in","z":"63842e72.893f78","name":"Sensor Requests Config","topic":"MySensors/+/255/3/0/6","broker":"8e3e8f02.7fd0c","x":105,"y":993,"wires":[["cd60b38.ef7405"]]},{"id":"86a8016b.bd47a","type":"mqtt out","z":"63842e72.893f78","name":"","topic":"","qos":"","retain":"","broker":"8e3e8f02.7fd0c","x":672,"y":993,"wires":[]},{"id":"65a6cc53.392ccc","type":"function","z":"63842e72.893f78","name":"Metric/Imperial definition","func":"var config = \"M\" ; //M for metric, and I for imperial\n\nmsg.payload = config + \"\\n\";\nreturn msg;","outputs":1,"noerr":0,"x":488,"y":993,"wires":[["86a8016b.bd47a","165c11cd.40adbe"]]},{"id":"165c11cd.40adbe","type":"debug","z":"63842e72.893f78","name":"","active":true,"console":"false","complete":"false","x":692,"y":952,"wires":[]},{"id":"cd60b38.ef7405","type":"delay","z":"63842e72.893f78","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":295,"y":993,"wires":[["65a6cc53.392ccc"]]},{"id":"9687065f.28c08","type":"comment","z":"63842e72.893f78","name":"I_CONFIG handler ([0-255];255;3;0;6;[M or I])","info":"Whenever a sensor announces itself to the network as [any];255;3;0;6;(null),\n\nThe cntroller returns a M for metric or I for imperial. \nTo my understanding, imperial measurement reportings aren't used.\n\n\nA rate limiter was required as to keep NR and the sensor from a spam-loop","x":298,"y":1030,"wires":[]}]```
    barduinoB 1 Reply Last reply
    0
    • crankyC cranky

      This flow takes care of the challenge/response for when a sensor asks what config to use (Metric or imperial).

      By default, the code returns M for metric. I don't believe Imperial is used anywhere, but it can be changed to I... if you support it in your code. (Honestly, no clue, but some sketches do make use of the call getConfig() .)

      [{"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":"57ad0c01.895c9c","type":"mqtt in","z":"63842e72.893f78","name":"Sensor Requests Config","topic":"MySensors/+/255/3/0/6","broker":"8e3e8f02.7fd0c","x":105,"y":993,"wires":[["cd60b38.ef7405"]]},{"id":"86a8016b.bd47a","type":"mqtt out","z":"63842e72.893f78","name":"","topic":"","qos":"","retain":"","broker":"8e3e8f02.7fd0c","x":672,"y":993,"wires":[]},{"id":"65a6cc53.392ccc","type":"function","z":"63842e72.893f78","name":"Metric/Imperial definition","func":"var config = \"M\" ; //M for metric, and I for imperial\n\nmsg.payload = config + \"\\n\";\nreturn msg;","outputs":1,"noerr":0,"x":488,"y":993,"wires":[["86a8016b.bd47a","165c11cd.40adbe"]]},{"id":"165c11cd.40adbe","type":"debug","z":"63842e72.893f78","name":"","active":true,"console":"false","complete":"false","x":692,"y":952,"wires":[]},{"id":"cd60b38.ef7405","type":"delay","z":"63842e72.893f78","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":295,"y":993,"wires":[["65a6cc53.392ccc"]]},{"id":"9687065f.28c08","type":"comment","z":"63842e72.893f78","name":"I_CONFIG handler ([0-255];255;3;0;6;[M or I])","info":"Whenever a sensor announces itself to the network as [any];255;3;0;6;(null),\n\nThe cntroller returns a M for metric or I for imperial. \nTo my understanding, imperial measurement reportings aren't used.\n\n\nA rate limiter was required as to keep NR and the sensor from a spam-loop","x":298,"y":1030,"wires":[]}]```
      barduinoB Offline
      barduinoB Offline
      barduino
      wrote on last edited by
      #2

      @cranky ,

      do you have a git repository where we can download all the stuff?

      1 Reply Last reply
      0
      • crankyC Offline
        crankyC Offline
        cranky
        wrote on last edited by
        #3

        Not yet, but that was my goal tomorrow.

        My GH account is https://github.com/jwcrawley

        It'll be obvious when I add in the repo :) I'll also mention it here.

        Sincerely,
        Cranky

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        23

        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