Here’s a node-red node that can capture mqtt data (i.e. create mqtt lights and send them to your mqtt server) and translates them into tripled-up UDP calls that the Wiz bulbs will respond to. For the commands the bulbs expect, look at the documentation linked higher in this thread.
The calls to the UDP node is tripled up because I’ve noticed that the bulbs will often “miss” commands if they’re sent rapidly, but tripling up seems to fix this problem.
I haven’t been as successful in writing code to update HASS when the bulbs are changed elsewhere (Alexa, the Wiz app). While I can register the bulbs to send UDP commands to my server (as thus node-red), the 5 second ongoing updates are somewhat overwhelming, and I haven’t been able to suss out an API call that responds with bulb state.
Hope this helps someone.
[
{
"id": "3d109b6e.9aeda4",
"type": "tab",
"label": "Demo Flow",
"disabled": false,
"info": ""
},
{
"id": "34d9e40a.f75bcc",
"type": "json",
"z": "3d109b6e.9aeda4",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 310,
"y": 340,
"wires": [
[
"15fbe611.434b8a"
]
]
},
{
"id": "290eaf47.9580f",
"type": "comment",
"z": "3d109b6e.9aeda4",
"name": "Relay MQTT to UDP",
"info": "",
"x": 170,
"y": 260,
"wires": []
},
{
"id": "15fbe611.434b8a",
"type": "function",
"z": "3d109b6e.9aeda4",
"name": "relay to udp",
"func": "// expects the mqtt topic to be wizlight/ip/command\n\nvar command = msg.topic.split(\"/\")[2];\n\nmsg.ip = msg.topic.split(\"/\")[1];\n\nvar obj = {}; \nobj[command] = msg.payload;\n \nvar p = {};\n\nvar pl = {method:\"setPilot\", \n id:527, \n env:\"pro\", \n params : obj};\n\nmsg.payload = pl\n\nmsg.port = 38899\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 490,
"y": 340,
"wires": [
[
"ef2ef336.20cd1"
]
]
},
{
"id": "d99585ca.e81038",
"type": "mqtt in",
"z": "3d109b6e.9aeda4",
"name": "Wizlight In",
"topic": "wizlight/#",
"qos": "0",
"datatype": "auto",
"broker": "",
"x": 160,
"y": 340,
"wires": [
[
"34d9e40a.f75bcc"
]
]
},
{
"id": "adbcb2c3.f7b18",
"type": "udp out",
"z": "3d109b6e.9aeda4",
"name": "UDP auto port/ip",
"addr": "",
"iface": "",
"port": "",
"ipv": "udp4",
"outport": "38899",
"base64": false,
"multicast": "false",
"x": 1070,
"y": 200,
"wires": []
},
{
"id": "ef2ef336.20cd1",
"type": "json",
"z": "3d109b6e.9aeda4",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 690,
"y": 340,
"wires": [
[
"5212efd2.fd1b9"
]
]
},
{
"id": "541bd62d.bf5178",
"type": "repeat",
"z": "3d109b6e.9aeda4",
"name": "Triple It Up",
"repetitions": "3",
"elseOutput": false,
"outputs": 1,
"x": 810,
"y": 200,
"wires": [
[
"adbcb2c3.f7b18",
"ef2ef336.20cd1"
]
]
},
{
"id": "5212efd2.fd1b9",
"type": "delay",
"z": "3d109b6e.9aeda4",
"name": "",
"pauseType": "delay",
"timeout": "25",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 870,
"y": 340,
"wires": [
[
"541bd62d.bf5178"
]
]
}
]