Lab 42. Dashboard: reed switch

Expected completion time of this lab: 20 min.

  • Connect a reed switch to drive pin DP2 high/low

  • What circuit do you use?

    Answer 1:

  • Create the following Node-RED flow to enable digital input pin DP2

    A little help

    The function node contains the following code:

    msg.payload            = {
        "method" :  "PUT",
        "url" :     "/digital_in/D0", // D0==DP2
        "body":     {
            "enable":      msg.payload,
            "rate":        10000,
            "sampleCount": 1,
            "dataFormat":  1
        "token":    "myToken",
    return msg;
  • Add the necessary nodes to create the following dashboard:

Extra points!

Add a "notification" dashboard node which appears when the state toggles.