Node-Red Blue Switch ZHA Flow

Hi Folks,

Here’s a Node-RED flow/subflow for Inovelli Blue switches.
It’s a modified from the Z-Wave version(can’t remember source)
Features Up/Down: 1-5 taps, held, and released. Config: 1, and 2 taps
Just add the device id to the Device node and attach an Inovelli scene ZHA subflow node

inoblueflow

[
    {
        "id": "0ad4df0e7f32cd7f",
        "type": "subflow",
        "name": "Inovelli scenes ZHA",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 65,
                "y": 360,
                "wires": [
                    {
                        "id": "35630d399d38b44f"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 749,
                "y": 180,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 0
                    }
                ]
            },
            {
                "x": 749,
                "y": 225,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 1
                    }
                ]
            },
            {
                "x": 749,
                "y": 270,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 2
                    }
                ]
            },
            {
                "x": 749,
                "y": 315,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 3
                    }
                ]
            },
            {
                "x": 749,
                "y": 360,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 4
                    }
                ]
            },
            {
                "x": 749,
                "y": 405,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 5
                    }
                ]
            },
            {
                "x": 749,
                "y": 450,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 6
                    }
                ]
            },
            {
                "x": 758,
                "y": 522,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 0
                    }
                ]
            },
            {
                "x": 758,
                "y": 567,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 1
                    }
                ]
            },
            {
                "x": 758,
                "y": 612,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 2
                    }
                ]
            },
            {
                "x": 758,
                "y": 657,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 3
                    }
                ]
            },
            {
                "x": 758,
                "y": 702,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 4
                    }
                ]
            },
            {
                "x": 758,
                "y": 747,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 5
                    }
                ]
            },
            {
                "x": 758,
                "y": 792,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 6
                    }
                ]
            },
            {
                "x": 749,
                "y": 882,
                "wires": [
                    {
                        "id": "2952437261522b91",
                        "port": 0
                    }
                ]
            },
            {
                "x": 749,
                "y": 936,
                "wires": [
                    {
                        "id": "2952437261522b91",
                        "port": 1
                    }
                ]
            }
        ],
        "env": [],
        "color": "#DDAA99",
        "outputLabels": [
            "Up 1x",
            "Up 2x",
            "Up 3x",
            "Up 4x",
            "Up 5x",
            "Up held",
            "Up released",
            "Down 1x",
            "Down 2x",
            "Down 3x",
            "Down 4x",
            "Down 5x",
            "Down held",
            "Down released",
            "Config tap 1x",
            "Config tap 2x"
        ]
    },
    {
        "id": "35630d399d38b44f",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene ID",
        "property": "payload.event.params.button_pressed",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "3",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 231,
        "y": 360,
        "wires": [
            [
                "07a0b06d5ab3ce9b"
            ],
            [
                "0c681df92541d650"
            ],
            [
                "2952437261522b91"
            ]
        ]
    },
    {
        "id": "0c681df92541d650",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene Value (Up)",
        "property": "payload.event.params.press_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "3",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "4",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "5",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "6",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 7,
        "x": 558,
        "y": 270,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ],
        "outputLabels": [
            "Up 1x",
            "Up 2x",
            "Up 3x",
            "Up 4x",
            "Up 5x",
            "Up hold",
            ""
        ]
    },
    {
        "id": "2952437261522b91",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene Value (Config)",
        "property": "payload.event.params.press_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "3",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 560,
        "y": 909,
        "wires": [
            [],
            []
        ],
        "outputLabels": [
            "Single Config Tap",
            ""
        ]
    },
    {
        "id": "07a0b06d5ab3ce9b",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene Value (Down)",
        "property": "payload.event.params.press_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "3",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "4",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "5",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "6",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "2",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 7,
        "x": 550,
        "y": 639,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ],
        "outputLabels": [
            "Down 1x",
            "Down 2x",
            "Down 3x",
            "Down 4x",
            "Down 5x",
            "Down held",
            ""
        ]
    },
    {
        "id": "b0027e70f08cce75",
        "type": "server-events",
        "z": "caac49a3740b59c4",
        "name": "ZHA",
        "server": "",
        "version": 1,
        "event_type": "zha_event",
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "waitForRunning": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "$outputData(\"eventData\").event_type",
                "valueType": "jsonata"
            }
        ],
        "x": 90,
        "y": 620,
        "wires": [
            [
                "3144aed186073a24"
            ]
        ]
    },
    {
        "id": "6a9905b29515109f",
        "type": "subflow:0ad4df0e7f32cd7f",
        "z": "caac49a3740b59c4",
        "name": "",
        "x": 440,
        "y": 420,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ]
    },
    {
        "id": "3144aed186073a24",
        "type": "switch",
        "z": "caac49a3740b59c4",
        "name": "Device",
        "property": "payload.event.device_id",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 10,
        "x": 230,
        "y": 620,
        "wires": [
            [
                "6a9905b29515109f"
            ],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ]
    }
]
4 Likes

This is the way…if your switch is outputting events unlike mine currently with the signal/routing issues.

Updated! I don’t know if it broke or if I never tested it properly but when I tried to add my 2nd switch I found it wasn’t working. Had to modify the subflow for new parameters. Working great now!

[
    {
        "id": "0ad4df0e7f32cd7f",
        "type": "subflow",
        "name": "Inovelli scenes ZHA",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 65,
                "y": 360,
                "wires": [
                    {
                        "id": "35630d399d38b44f"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 749,
                "y": 180,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 0
                    }
                ]
            },
            {
                "x": 749,
                "y": 225,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 1
                    }
                ]
            },
            {
                "x": 749,
                "y": 270,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 2
                    }
                ]
            },
            {
                "x": 749,
                "y": 315,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 3
                    }
                ]
            },
            {
                "x": 749,
                "y": 360,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 4
                    }
                ]
            },
            {
                "x": 749,
                "y": 405,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 5
                    }
                ]
            },
            {
                "x": 749,
                "y": 450,
                "wires": [
                    {
                        "id": "0c681df92541d650",
                        "port": 6
                    }
                ]
            },
            {
                "x": 758,
                "y": 522,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 0
                    }
                ]
            },
            {
                "x": 758,
                "y": 567,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 1
                    }
                ]
            },
            {
                "x": 758,
                "y": 612,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 2
                    }
                ]
            },
            {
                "x": 758,
                "y": 657,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 3
                    }
                ]
            },
            {
                "x": 758,
                "y": 702,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 4
                    }
                ]
            },
            {
                "x": 758,
                "y": 747,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 5
                    }
                ]
            },
            {
                "x": 758,
                "y": 792,
                "wires": [
                    {
                        "id": "07a0b06d5ab3ce9b",
                        "port": 6
                    }
                ]
            },
            {
                "x": 749,
                "y": 882,
                "wires": [
                    {
                        "id": "2952437261522b91",
                        "port": 0
                    }
                ]
            },
            {
                "x": 749,
                "y": 936,
                "wires": [
                    {
                        "id": "2952437261522b91",
                        "port": 1
                    }
                ]
            }
        ],
        "env": [],
        "color": "#DDAA99",
        "outputLabels": [
            "Up 1x",
            "Up 2x",
            "Up 3x",
            "Up 4x",
            "Up 5x",
            "Up held",
            "Up released",
            "Down 1x",
            "Down 2x",
            "Down 3x",
            "Down 4x",
            "Down 5x",
            "Down held",
            "Down released",
            "Config tap 1x",
            "Config tap 2x"
        ]
    },
    {
        "id": "35630d399d38b44f",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene ID",
        "property": "payload.event.args.button",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "button_1",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "button_2",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "button_3",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 231,
        "y": 360,
        "wires": [
            [
                "07a0b06d5ab3ce9b"
            ],
            [
                "0c681df92541d650"
            ],
            [
                "2952437261522b91"
            ]
        ]
    },
    {
        "id": "0c681df92541d650",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene Value (Up)",
        "property": "payload.event.args.press_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "press",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "double",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "triple",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "quadruple",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "quintuple",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "hold",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "release",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 7,
        "x": 558,
        "y": 270,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ],
        "outputLabels": [
            "Up 1x",
            "Up 2x",
            "Up 3x",
            "Up 4x",
            "Up 5x",
            "Up hold",
            ""
        ]
    },
    {
        "id": "2952437261522b91",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene Value (Config)",
        "property": "payload.event.args.press_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "press",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "double",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 560,
        "y": 909,
        "wires": [
            [],
            []
        ],
        "outputLabels": [
            "Single Config Tap",
            ""
        ]
    },
    {
        "id": "07a0b06d5ab3ce9b",
        "type": "switch",
        "z": "0ad4df0e7f32cd7f",
        "name": "Scene Value (Down)",
        "property": "payload.event.args.press_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "press",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "double",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "triple",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "quadruple",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "quintuple",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "hold",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "release",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 7,
        "x": 550,
        "y": 639,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ],
        "outputLabels": [
            "Down 1x",
            "Down 2x",
            "Down 3x",
            "Down 4x",
            "Down 5x",
            "Down held",
            ""
        ]
    },
    {
        "id": "c8cec0d252bc612c",
        "type": "server-events",
        "z": "f569f18608087d5d",
        "name": "ZHA",
        "server": "36cabfe6e7e82219",
        "version": 1,
        "event_type": "zha_event",
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "waitForRunning": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "$outputData(\"eventData\").event_type",
                "valueType": "jsonata"
            }
        ],
        "x": 510,
        "y": 360,
        "wires": [
            [
                "b5cdc30e2c9ad0cd"
            ]
        ]
    },
    {
        "id": "b5cdc30e2c9ad0cd",
        "type": "switch",
        "z": "f569f18608087d5d",
        "name": "Device",
        "property": "payload.event.device_id",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 12,
        "x": 610,
        "y": 360,
        "wires": [
            [
                "6aa222913f2cb415"
            ],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ],
        "outputLabels": [
            "Master Bathroom",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            ""
        ]
    },
    {
        "id": "6aa222913f2cb415",
        "type": "subflow:0ad4df0e7f32cd7f",
        "z": "f569f18608087d5d",
        "name": "",
        "x": 800,
        "y": 360,
        "wires": [
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            [],
            []
        ]
    },
    {
        "id": "36cabfe6e7e82219",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30"
    }
]

Okay, so let me start with saying I am extremely new to Node Red…

Okay so I have a habitat that I use to control my zigbee devices (inovelli switches included in that) but I use Maker API to control then within HomeAssistant. So I should be able to get states for the devices etc. DO I need to create distinct scenes for each of these repective flows to work correctly? I’m not familiar with ZHA sorry if this is just a dumb question

@Gangoke
Do you really need to use a subflow to handle it from ZHA events? Have you tried using the newer Device node in Node-red? It Should have all the options:

@benjaminleelancaster
ZHA is an integration for Home Assistant that many use to control there Zigbee USB sticks. You may have luck using the device node above, but I am unaware of how it works when bringing devices from Hubitat into Home Assistant. But worth a try!

Any thing in particular holding you back from fully switching to Home Assistant?

1 Like