1.0.14 • Published 2 years ago

wiz-local v1.0.14

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Wiz Local

js-standard-style

Find Wiz devices and control them with the Wiz Local app. Each method will return a Promise that resolves with the result of the operation.

Installation

Npm

npm install wiz-local

Example

const {discovery, toggle, temperature, getState, rgb, dimm} = require('wiz-local');

// Find Wiz local devices.
async () => {
  const devices = await discovery();
  console.log(devices);
  devices /*
  [
    {
    "id": "00:00:00:00:00:00",
    "mac": "00:00:00:00:00:00",
    "ip": "192.168.0.102",
    "vendor": "wiz",
    "name": "",
    "description": "",
    "type": "",
    "status": "",
    "location": ""
  },
  {
    "id": "00:00:00:00:00:00",
    "mac": "00:00:00:00:00:00",
    "ip": "192.168.0.119",
    "vendor": "wiz",
    "name": "",
    "description": "",
    "type": "",
    "status": "",
    "location": ""
  },
  ]
    */
}

// Get the state of a device.
async () => {
  const devices = await discovery();
  const device = devices[0];
  const state = await getState(device);
  console.log(state);
  state /*
  {
      "mac": "00000000",
      "rssi": -49,
      "src": "",
      "state": false,
      "sceneId": 0,
      "temp": 6500,
      "dimming": 100
    }
    */
}

// Toggle a device.
async () => {
  const devices = await discovery();
  const device = devices[0];
  await toggle(device, true); // true to turn on and false to turn off.(Use boolean, not string)
}

// Change the light temperature of a device.
async () => {
  const devices = await discovery();
  const device = devices[0];
  await temperature(device, 2700); // 2200 to 6500 is the temperature in Kelvin.(Use integer, not string)
}

// Change the color of a device.
async () => {
  const devices = await discovery();
  const device = devices[0];
  await rgb(device, 255, 255, 255); // 0 to 255 is the color value.(Use integer, not string)
}

// Change the intensity of a device.
async () => {
  const devices = await discovery();
  const device = devices[0];
  await dimm(device, 100); // 0 to 100 is the intensity value.(Use integer, not string)
}

    
    ```
1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago