node-red inject counter


npm install node-red-contrib-counter

[
    {
        "id": "2bf4cd08347d634e",
        "type": "inject",
        "z": "be13ab6139516ded",
        "name": "data exist",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 240,
        "y": 460,
        "wires": [
            [
                "af8e3d8cfdb1cf9d"
            ]
        ]
    },
    {
        "id": "f9384a2ea891f2cd",
        "type": "counter",
        "z": "be13ab6139516ded",
        "name": "",
        "init": "0",
        "step": 1,
        "lower": null,
        "upper": null,
        "mode": "increment",
        "outputs": "1",
        "x": 480,
        "y": 580,
        "wires": [
            [
                "b4b4c4e046fb3c77"
            ]
        ]
    },
    {
        "id": "af8e3d8cfdb1cf9d",
        "type": "function",
        "z": "be13ab6139516ded",
        "name": "msg object",
        "func": "msg.increment = 1;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 270,
        "y": 580,
        "wires": [
            [
                "f9384a2ea891f2cd"
            ]
        ]
    },
    {
        "id": "b4b4c4e046fb3c77",
        "type": "function",
        "z": "be13ab6139516ded",
        "name": "",
        "func": "return {\n  payload: {\n\n\t\"counter\": msg.count\n\n}\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 650,
        "y": 480,
        "wires": [
            [
                "0f427c2afac615b4"
            ]
        ]
    },
    {
        "id": "0f427c2afac615b4",
        "type": "debug",
        "z": "be13ab6139516ded",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 890,
        "y": 480,
        "wires": []
    }
]

Ditunggu komennya ...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.