Home

Awesome

OpenWiz

Nuget

OpenWiz is a reverse-engineered implementation of the LAN API used between Wiz brand smart lights and the Wiz Android App. The project targets .NET Core, and is 100% C#.

Acknowledgements

These projects have been every useful in confirming my understanding of how Wiz brand lights work: https://github.com/basriram/openhab2-addons/tree/master/addons/binding/org.openhab.binding.wizlighting https://github.com/SRGDamia1/openhab2-addons/tree/wizlighting2/bundles/org.openhab.binding.wizlighting

Supported Devices

At the moment, only the BR30 bulbs (those in my poessesion) have been tested.

Current Findings

Network

The service uses UDP for transport. Port 38900 is used by the App to recieve, while 38899 is used by the light to recieve. Broadcasts are made by clients to their broadcast address or 255.255.255.255.

Format

Data is exchanged between devices using JSON, seemingly encoded in UTF8. The format for JSON objects is somewhat as follows:

{
  "method" : "",
  "params" : {},
  "result" : {},
  "error"  : {}
}

Not all fields are used in every packet. For example, to request the current state of the light, one may use:

{
  "method" : "getPilot"
}

The light then responds with something like the following:

{
  "method" : "getPilot",
  "result" : {
    "mac" : "000000000000",
    "rssi" : -74,
    "state" : true,
    "sceneId" : 12,
    "speed" : 100,
    "temp" : 4200,
    "dimming" : 34
  }
}

All MAC addresses are unformatted, 12-digit, lowercase hex strings. All IP addresses are IPv4, in standard dot notation.

JSON Fields

method : The method called, either by the app or the light.

result and params : Similar fields used to capture the state variables of a light.

error : Describes an error following a transmission.

How to use

If you plan to have the user input the IP of their lights, you need only use WizHandle and WizSocket. The WizSocket can perform IO operations on a given WizHandle. Treat the WizSocket like any other socket, and the WizHandle like a buffer with the exception that it is not modified during send operations.

If you are seeking to enable auto-discovery, you will need the user's Home ID in conjuction with WizDiscoveryService. This is done in good faith to avoid modifying the state of another home's lights.

The Registration operation is not required to modify a light's state, however please be curteous.