GPIO input to msg.reset

Hi
i wan´t to toggle input from Raspi and convert this to msg.reset. with my toggle inject it works, what i am doing wrong?

[
{
"id": "5542a8a0.2ca958",
"type": "tab",
"label": "Flow 4",
"disabled": false,
"info": ""
},
{
"id": "f72b7fba427a9063",
"type": "debug",
"z": "5542a8a0.2ca958",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "reset",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 980,
"y": 180,
"wires":
},
{
"id": "da8ccfee81eca535",
"type": "rpi-gpio in",
"z": "5542a8a0.2ca958",
"name": "",
"pin": "27",
"intype": "up",
"debounce": "25",
"read": false,
"bcm": true,
"x": 260,
"y": 180,
"wires": [
[
"a0ab2fb7ef09f749"
]
]
},
{
"id": "a0ab2fb7ef09f749",
"type": "toggle",
"z": "5542a8a0.2ca958",
"name": "",
"onOffTopic": "",
"onValue": "reset",
"onType": "str",
"offValue": "reset",
"offType": "str",
"toggleTopic": "",
"toggleValue": "true",
"toggleType": "bool",
"passOnOff": "",
"x": 470,
"y": 180,
"wires": [
[
"cb77bffed11082a8"
]
]
},
{
"id": "cb77bffed11082a8",
"type": "change",
"z": "5542a8a0.2ca958",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "reset",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 180,
"wires": [
[
"f72b7fba427a9063"
]
]
},
{
"id": "fa5eabcfaf8d407c",
"type": "inject",
"z": "5542a8a0.2ca958",
"name": "toggle",
"props": [
{
"p": "reset",
"v": "reset",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 270,
"y": 340,
"wires": [
[
"f72b7fba427a9063"
]
]
}
]

Hi.

Your flow is unusable.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

[
    {
        "id": "60ddb49f23d04d93",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "40e5321e4f897792",
        "type": "debug",
        "z": "60ddb49f23d04d93",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "reset",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1140,
        "y": 260,
        "wires": []
    },
    {
        "id": "6c967b019c09a4a1",
        "type": "rpi-gpio in",
        "z": "60ddb49f23d04d93",
        "name": "",
        "pin": "27",
        "intype": "up",
        "debounce": "25",
        "read": false,
        "bcm": true,
        "x": 420,
        "y": 260,
        "wires": [
            [
                "a992d6c9c2ed4a29"
            ]
        ]
    },
    {
        "id": "a992d6c9c2ed4a29",
        "type": "toggle",
        "z": "60ddb49f23d04d93",
        "name": "",
        "onOffTopic": "",
        "onValue": "reset",
        "onType": "str",
        "offValue": "reset",
        "offType": "str",
        "toggleTopic": "",
        "toggleValue": "true",
        "toggleType": "bool",
        "passOnOff": "",
        "x": 630,
        "y": 260,
        "wires": [
            [
                "c8efaaa7a598ca0c"
            ]
        ]
    },
    {
        "id": "c8efaaa7a598ca0c",
        "type": "change",
        "z": "60ddb49f23d04d93",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "reset",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 870,
        "y": 260,
        "wires": [
            [
                "40e5321e4f897792"
            ]
        ]
    }
]

What do you mean my toggle? Do you mean inverse? Or do you mean to flip between "on" and "off" or true and false? or do you mean when PIN 13 is HIGH to output a certain value?

Please explain exactly what you are hoping to get out of this
image

do you expect { payload: "reset" } or { reset: true } or { reset: "reset" } ?

hi Steve
when PIN 13 goes HIGH i wan´t to geht msg.reset, if pin 13 goas LOW do nothing

and what should msg.reset contain? a string? a boolean? a number?

I think you simply want a switch node to filter out payload of 1 then a change node to set msg.whatever to "whatever" (no need for custom contrib nodes for something so simple)

[
    {
        "id": "40e5321e4f897792",
        "type": "debug",
        "z": "60ddb49f23d04d93",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "reset",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2290.000026702881,
        "y": 140.00000762939453,
        "wires": []
    },
    {
        "id": "6c967b019c09a4a1",
        "type": "rpi-gpio in",
        "z": "60ddb49f23d04d93",
        "name": "",
        "pin": "27",
        "intype": "up",
        "debounce": "25",
        "read": false,
        "bcm": true,
        "x": 1730.0000267028809,
        "y": 172.00000762939453,
        "wires": [
            [
                "9ae0c4c902857a66"
            ]
        ]
    },
    {
        "id": "c8efaaa7a598ca0c",
        "type": "change",
        "z": "60ddb49f23d04d93",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "reset",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "reset",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2062.000026702881,
        "y": 172.00000762939453,
        "wires": [
            [
                "40e5321e4f897792",
                "203920077eb9627a"
            ]
        ]
    },
    {
        "id": "9ae0c4c902857a66",
        "type": "switch",
        "z": "60ddb49f23d04d93",
        "name": "== 1 ?",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1888.0000267028809,
        "y": 172.00000762939453,
        "wires": [
            [
                "c8efaaa7a598ca0c"
            ]
        ]
    },
    {
        "id": "203920077eb9627a",
        "type": "debug",
        "z": "60ddb49f23d04d93",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2300.000026702881,
        "y": 204.00000762939453,
        "wires": []
    },
    {
        "id": "ef5d109123cb0925",
        "type": "inject",
        "z": "60ddb49f23d04d93",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 1740.0000267028809,
        "y": 252.00000762939453,
        "wires": [
            [
                "9ae0c4c902857a66"
            ]
        ]
    },
    {
        "id": "2fedda50742cbb8c",
        "type": "inject",
        "z": "60ddb49f23d04d93",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 1744.0000267028809,
        "y": 300.00000762939453,
        "wires": [
            [
                "9ae0c4c902857a66"
            ]
        ]
    }
]

Thanks Steve, it works; i have to learn very much!!!

I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.