# Switch on buffer payload type

**URL:** https://discourse.nodered.org/t/switch-on-buffer-payload-type/99767
**Category:** General
**Created:** [24 November 2025 15:51 UTC](https://discourse.nodered.org/t/switch-on-buffer-payload-type/99767 "2025-11-24T15:51:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [24 November 2025 15:51 UTC](https://discourse.nodered.org/t/switch-on-buffer-payload-type/99767/1 "2025-11-24T15:51:04Z")

</div>

I've got an MQTT buffer feed of the RGB values of a coloured switch press

e.g. press red - get [255,0,0], blue get [0,0,255] etc

I'd like to have a switch that routes each colour to a different output but there doesn't seem to be a switch comparison operator to do that

Any ideas?

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [24 November 2025 16:03 UTC](https://discourse.nodered.org/t/switch-on-buffer-payload-type/99767/2 "2025-11-24T16:03:47Z")

</div>

As a workaround - I've set the MQTT out to be a base64 encoded string and then just used string comparison  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e37937e33383a5b42c5bacb9a4606b4f1eb84de0.png)

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [24 November 2025 16:39 UTC](https://discourse.nodered.org/t/switch-on-buffer-payload-type/99767/3 "2025-11-24T16:39:17Z")

</div>

```auto
[
    {
        "id": "928a4710e5e70a19",
        "type": "inject",
        "z": "d49edf046b897d61",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[255,0,0]",
        "payloadType": "bin",
        "x": 190,
        "y": 100,
        "wires": [
            [
                "7a703f07cf234f1c"
            ]
        ]
    },
    {
        "id": "8cc4566c09cb0e64",
        "type": "debug",
        "z": "d49edf046b897d61",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 100,
        "wires": []
    },
    {
        "id": "7a703f07cf234f1c",
        "type": "change",
        "z": "d49edf046b897d61",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "result",
                "pt": "msg",
                "to": "payload[0]",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 400,
        "y": 100,
        "wires": [
            [
                "8cc4566c09cb0e64"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [22 February 2026 16:39 UTC](https://discourse.nodered.org/t/switch-on-buffer-payload-type/99767/4 "2026-02-22T16:39:53Z")

</div>

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