Controlling Wiz WiFi LED RGB lightbulbs

Daniel Browne's icon

Hello community. I have spent the last month creating max patches for various utilities I am seeing a need for in my studio. Most have been based on receiving OSC from bitfocus companion and recording/sending out OSC data to control hardware on my network.

My next endeavor involves a lot of things that are outside of my scope, but i am hoping to use this thread as a way to connect the dots and get some input from you guys. The goal would be to create a patch that can control the various parameters of a Wiz RGB LED WiFi lightbulb.

Parameters to control:

  • scene Id - calls one of the predefined scenes (int from 0 to 32)

  • speed - sets the color changing speed in percent

  • dimming - sets the dimmer of the bulb in percent

  • temp - sets color temperature in kelvins

  • r - red color range 0-255

  • g - green color range 0-255

  • b - blue color range 0-255

  • c - cold white range 0-255

  • w - warm white range 0-255

  • id - the bulb id

  • state - when it's on or off

Considerations for patch

  • Wiz WiFi bulbs receive commands via Raw UDP. I have been looking into the Sadam Library as the method of getting Raw UDP out of max.

  • The ports that Wiz Wifi bulbs communicate on are:

  • 38899 and 38900 for UDP on local network

  • 8883 to establish secure connection with our servers over the internet. This is the MQTT port.

  • TCP- 123 - to obtain the time over the internet, for example for scheduled events

  • UDP- 80 - to the internet

  • TCP- 53 - to the internet

  • TCP and UDP to resolve Domain Name issues

  • 443 - TCP to manage https

  • IP and Mac Address info per bulb(I have found this info in my wiz app)

Most of my resources have been controlling the Wiz lights with other scripts(python, nodejs) and where I have found Raw UDP commands, I am not sure if these UDP commands are based on those scripts or if they can be sent directly via Max unchanged(leaning toward these commands are native to the script).

I am wondering if the best path is to try to incorporate these scripts into the max patch somehow(i've seen some info on using nodejs in max) or to try and find the messages the lights expect to receive and try to send them directly without referencing a piece of code(python or nodejs) in the patch.

I am a noob when it comes to programming in relation to computers and my background is mostly in music production and midi with some experience making max patches. Any help, guidance, or corrections would be appreciated.

Resources: https://github.com/sbidy/pywizlight

https://community.tp-link.com/us/home/forum/topic/181340

https://github.com/sbidy/wiz_light/blob/master/README.md
http://blog.dammitly.net/2019/10/cheap-hackable-wifi-light-bulbs-or-iot.html

https://npm.io/package/@suisse00/wiz-local-control

https://community.hubitat.com/t/release-philips-wiz-color-light-driver-v1-01/31818/16