Giter Club home page Giter Club logo

wyze-api's Introduction

wyze-api

npm npm Chat GitHub last commit

Funding Donate Donate Donate

This is an unofficial Wyze API. This library uses the internal APIs from the Wyze mobile app. A list of all Wyze devices can be retrieved to check the status of Cameras, Senors, Bulbs, Plugs, Locks and more. This API can turn on and off cameras, lightbulbs and plugs and more.

Setup

npm install wyze-api --save

Example

const Wyze = require('wyze-api')
const Logger = require("@ptkdev/logger")
const logger = new Logger()

const options = {
  username: process.env.username,
  password: process.env.password,
  keyId: process.env.keyId,
  apiKey: process.env.apiKey,
  persistPath: "./",
  logLevel: "none"
}
const wyze = new Wyze(options, logger)

  ; (async () => {
    let device, state, result

    // Get all Wyze devices
    const devices = await wyze.getDeviceList()
    console.log(devices)

    // Get a Wyze Bulb by name and turn it off.
    device = await wyze.getDeviceByName('Porch Light')
    result = await wyze.turnOff(device)
    console.log(result)

    // Get the state of a Wyze Sense contact sensor
    device = await wyze.getDeviceByName('Front Door')
    state = await wyze.getDeviceState(device)
    console.log(`${device.nickname} is ${state}`)

  })()

Run

[email protected] password=123456 keyId=2222222 apiKey=222222 node index.js

Helper methods

Use this helper methods to interact with wyze-api.

  • wyze.getDeviceList()
  • wyze.getDeviceByName(nickname)
  • wyze.getDeviceByMac(mac)
  • wyze.getDevicesByType(type)
  • wyze.getDevicesByModel(model)
  • wyze.getDeviceGroupsList()
  • wyze.getDeviceSortList()
  • wyze.turnOn(device)
  • wyze.turnOff(device)
  • wyze.lock(device)
  • wyze.unlock(device)
  • wyze.getDeviceStatus(device)
  • wyze.getDeviceState(device)

Internal methods

  • wyze.login()
  • wyze.getRefreshToken()
  • wyze.getObjectList()
  • wyze.runAction(instanceId, providerKey, actionKey)
  • wyze.getDeviceInfo(deviceMac, deviceModel)
  • wyze.getPropertyList(deviceMac, deviceModel)
  • wyze.setProperty(deviceMac, deviceModel, propertyId, propertyValue)
  • wyze.controllock(deviceMac, deviceModel, action)
  • wyze.getLockInfo(deviceMac, deviceModel)
  • wyze.getIotProp(deviceMac, keys)
  • wyze.setIotProp(deviceMac, product_model, propKey, value)
  • wyze.getUserProfile()
  • wyze.disableRemeAlarm(hms_id)
  • wyze.getPlanBindingListByUser()
  • wyze.monitoringProfileStateStatus(hms_id)
  • wyze.monitoringProfileActive(hms_id, home, away)
  • wyze.getPlanBindingListByUser()
  • wyze.thermostatGetIotProp(deviceMac, keys)

Other Info

Special thanks to the following projects for reference and inspiration:

  • ha-wyzeapi, a Wyze integration for Home Assistant.
  • wyze-node, a Node library for the Wyze API.

wyze-api's People

Contributors

hgoscenski avatar jfarmer08 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.