Skip to content

Node-RED Flow Examples

How to read a digital input?

Copy this flow and take it to Node-Red.

[
   {
      "id":"ac50862f.f90d88",
      "type":"tab",
      "label":"eMOD API general calls demo",
      "disabled":false,
      "info":""
   },
   {
      "id":"5b636866.929348",
      "type":"debug",
      "z":"ac50862f.f90d88",
      "name":"",
      "active":true,
      "tosidebar":true,
      "console":false,
      "tostatus":false,
      "complete":"false",
      "x":1297,
      "y":896,
      "wires":[

      ]
   },
   {
      "id":"1b332d8a.6e7402",
      "type":"inject",
      "z":"ac50862f.f90d88",
      "name":"Reset a pulse count",
      "topic":"",
      "payload":"{\"reset_pulse_count\": 0}",
      "payloadType":"json",
      "repeat":"",
      "crontab":"",
      "once":false,
      "onceDelay":0.1,
      "x":597,
      "y":996,
      "wires":[
         [
            "a742fbeb.b1a538"
         ]
      ]
   },
   {
      "id":"4a5a1814.caa188",
      "type":"inject",
      "z":"ac50862f.f90d88",
      "name":"Get all input status",
      "topic":"",
      "payload":"{\"get_all\": \"status\"} ",
      "payloadType":"json",
      "repeat":"",
      "crontab":"",
      "once":false,
      "onceDelay":0.1,
      "x":597,
      "y":776,
      "wires":[
         [
            "a742fbeb.b1a538"
         ]
      ]
   },
   {
      "id":"18b4be94.a29291",
      "type":"inject",
      "z":"ac50862f.f90d88",
      "name":"Get all pulse counters",
      "topic":"",
      "payload":"{\"get_all\": \"pulse_count\"} ",
      "payloadType":"json",
      "repeat":"",
      "crontab":"",
      "once":false,
      "onceDelay":0.1,
      "x":587,
      "y":896,
      "wires":[
         [
            "a742fbeb.b1a538"
         ]
      ]
   },
   {
      "id":"a742fbeb.b1a538",
      "type":"10DI",
      "z":"ac50862f.f90d88",
      "name":"",
      "modNumEnabled":false,
      "modNum":"",
      "modConfig":"129ab794.dfc928",
      "x":1037,
      "y":896,
      "wires":[
         [
            "5b636866.929348"
         ]
      ]
   },
   {
      "id":"66fd759f.02f2dc",
      "type":"inject",
      "z":"ac50862f.f90d88",
      "name":"Reset all pulse counts",
      "topic":"",
      "payload":"{\"reset_pulse_count\": \"all\"}",
      "payloadType":"json",
      "repeat":"",
      "crontab":"",
      "once":false,
      "onceDelay":0.1,
      "x":587,
      "y":1056,
      "wires":[
         [
            "a742fbeb.b1a538"
         ]
      ]
   },
   {
      "id":"3fd71ca5.3e3c74",
      "type":"inject",
      "z":"ac50862f.f90d88",
      "name":"Get an input status",
      "topic":"",
      "payload":"{\"get_one\": {\"index\": 0, \"mode\": \"status\"}} ",
      "payloadType":"json",
      "repeat":"",
      "crontab":"",
      "once":false,
      "onceDelay":0.1,
      "x":597,
      "y":716,
      "wires":[
         [
            "a742fbeb.b1a538"
         ]
      ]
   },
   {
      "id":"af270938.1b8ce8",
      "type":"inject",
      "z":"ac50862f.f90d88",
      "name":"Get an pulse counter",
      "topic":"",
      "payload":"{\"get_one\": {\"index\": 0, \"mode\": \"pulse_count\"}}",
      "payloadType":"json",
      "repeat":"",
      "crontab":"",
      "once":false,
      "onceDelay":0.1,
      "x":597,
      "y":835,
      "wires":[
         [
            "a742fbeb.b1a538"
         ]
      ]
   },
   {
      "id":"129ab794.dfc928",
      "type":"10DI-Config",
      "z":"",
      "name":"",
      "pulseFilterMsI1":"10",
      "pulseFilterMsI2":"10",
      "pulseFilterMsI3":"10",
      "pulseFilterMsI4":"10",
      "pulseFilterMsI5":"10",
      "pulseFilterMsI6":"10",
      "pulseFilterMsI7":"10",
      "pulseFilterMsI8":"10",
      "pulseFilterMsI9":"10",
      "pulseFilterMsI10":"10",
      "eventMode":"poll",
      "intervalMs":"1000",
      "threshold":"1"
   }
]