Class WizLight<S>

WizLight Client

Quick tutorial to get a green light on wiz based bulb:

const wl = new WizLight('192.168.1.2'); // IP address of your light (check from router)
const data = await wl.setLightProps({
r: 0,
g: 255,
b: 0,
dimming: 100
});

Supports options configuration:

const wl = new WizLight('192.168.1.2', { // IP address of your light (check from router)
// Port number;
// Default is 38899
port: 38899,

// As all the communication happens over UDP, there is no direct response to the request.
// We have to wait for some time to receive a message from the device to know if the request was served or not, post
// that time the request is considered as failed and retry mechanism kicks in.

// This represents the time that we should wait before retrying.
// Default is 1000ms
statusCheckTimeout: 1000,

// Number of times we should retry a request in case of a failure.
// Default is 5
retryTimes: 5,
});

This lib would not have been possible without the help that I received from this article: https://aleksandr.rogozin.us/blog/2021/8/13/hacking-philips-wiz-lights-via-command-line

Type Parameters

  • S extends string

Implements

Constructors

  • Creates a new instance of WizLight client.

    Type Parameters

    • S extends string

    Parameters

    • ip: IPAdd<S>

      IP address to connect to as a string.

    • Optional options: IWizLightOptions

      optional options to configer the client.

    Returns WizLight<S>

Properties

state: ILightProps = ...

Methods

  • Parameters

    • params: Record<string, unknown>

    Returns {
        method: string;
        params: Record<string, unknown>;
    }

    • method: string
    • params: Record<string, unknown>
  • Parameters

    • params: Record<string, unknown>

    Returns {
        method: string;
        params: Record<string, unknown>;
    }

    • method: string
    • params: Record<string, unknown>
  • Sets the properties of the light, i.e. color, dimming, cold or warm

    Parameters

    • props: ILightProps

      properties of the light, i.e. color, dimming, cold or warm

    Returns Promise<Boolean>

  • Turns the light on or off.

    Parameters

    • status: Boolean

      Status of the light, should it be ON(true) or OFF(false).

    Returns Promise<Boolean>