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.
npm install wyze-api --save
const Wyze = require('wyze-api')
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)
; (async () => {
let device, state, result
// Get all Wyze devices
const devices = await wyze.getDeviceList()
console.log(devices); // you could also use apiLogEnabled in options instead of your own console.log
// Get a Wyze Bulb by name and turn it off.
device = await wyze.getDeviceByName('Porch Light')
result = await wyze.lightTurnOff(device.mac, device.product_model)
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}`)
})()
username=first.last@email.om password=123456 keyId=2222222 apiKey=222222 node index.js
Use these 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.getDeviceStatus(device)
- wyze.getDeviceState(device)
- wyze.getDevicePID(device.mac, device.product_model)
- wyze.getDeviceStatePID(device.mac, device.product_model, pid)
- wyze.cameraPrivacy(device.mac, device.product_model, value)
- wyze.cameraTurnOn(device.mac, device.product_model)
- wyze.cameraTurnOff(device.mac, device.product_model)
- wyze.cameraSiren(device.mac, device.product_model, value)
- wyze.cameraSirenOn(device.mac, device.product_model)
- wyze.cameraSirenOff(device.mac, device.product_model)
- wyze.cameraFloodLight(device.mac, device.product_model, value)
- wyze.cameraFloodLightOn(device.mac, device.product_model)
- wyze.cameraFloodLightOff(device.mac, device.product_model)
- wyze.cameraSpotLight(device.mac, device.product_model, value)
- wyze.cameraSpotLightOn(device.mac, device.product_model)
- wyze.cameraSpotLightOff(device.mac, device.product_model)
- wyze.cameraMotionOn(device.mac, device.product_model)
- wyze.cameraMotionOff(device.mac, device.product_model)
- wyze.cameraSoundNotificationOn(device.mac, device.product_model)
- wyze.cameraSoundNotificationOff(device.mac, device.product_model)
- wyze.cameraNotifications(device.mac, device.product_model, value)
- wyze.cameraNotificationsOn(device.mac, device.product_model)
- wyze.cameraNotificationsOff(device.mac, device.product_model)
- wyze.cameraMotionRecording(device.mac, device.product_model, value)
- wyze.cameraMotionRecordingOn(device.mac, device.product_model)
- wyze.cameraMotionRecordingOff(device.mac, device.product_model)
These return the credentials a WebRTC client (werift, go2rtc, Kinesis Video Streams WebRTC SDK) needs to negotiate a live stream — they do not return a playable URL on their own.
Primary:
- wyze.getCameraWebRTCConnectionInfo(mac, model, [options]) — bundled, ready-to-use shape:
{signalingUrl, iceServers, authToken, clientId, mac, model, substream, cached}.iceServersare normalized to the{urls, ...}shapeRTCPeerConnectionexpects;signalingUrlhas any double-encoding decoded and (by default) the generatedclientIdinjected asX-Amz-ClientId. Cached for 60s per(mac, substream). Options:substream,includeClientId,clientId,clientIdPrefix,noCache,cacheTtlMs. - wyze.getCameraWebRTCConnectionInfoWithReconnect(mac, model, [options], [retryOptions]) — same, with exponential-backoff retry.
retryOptions:{maxAttempts=3, baseDelayMs=2000, onRetry}.
Lower-level:
- wyze.cameraGetStreamInfo(mac, model, [options]) — raw API shape
{signaling_url, ice_servers, auth_token, ...}.options.substreamrequests the lower-bitrate sub stream. - wyze.cameraGetSignalingUrl(mac, model, [options]) — just the raw signaling URL string
- wyze.cameraGetIceServers(mac, model, [options]) — just the raw ICE/STUN/TURN server list
Helpers:
- wyze.createCameraStreamClientId(deviceOrMac, [prefix="viewer"]) — generate a unique viewer client ID
- wyze.normalizeCameraSignalingUrl(url) — fix double-encoded Kinesis URLs
- wyze.sanitizeCameraIceServers(iceServers) — convert
{url}entries to{urls}forRTCPeerConnection - wyze.parseCameraStatus(streamInfoResponse) — non-throwing parse →
{online, powered}ornull - wyze.cameraStreamWithReconnect(fn, [retryOptions]) — exponential-backoff retry wrapper for any stream call
- wyze.clearCameraStreamCache([mac]) — clear cached stream info (one camera or all)
- WyzeAPI.StreamStatus — lifecycle constants (
OFFLINE,STOPPING,DISABLED,STOPPED,CONNECTING,CONNECTED)
Pure (sync, take a device object):
- wyze.cameraIsOnline(device) — true if
device.device_params.status === 1 - wyze.cameraGetThumbnail(device) — first thumbnail URL, or null
- wyze.cameraGetSnapshot(device) — first thumbnail object (
{url, type, ts, ...}), or null - wyze.cameraToSummary(device) —
{mac, productModel, nickname, online, thumbnail} - wyze.cameraGetSignalStrength(device) / cameraGetIp(device) / cameraGetFirmware(device) / cameraGetTimezone(device) / cameraGetLastSeen(device)
Lookups (async):
- wyze.getCameras() — list of all camera devices
- wyze.getOnlineCameras() / getOfflineCameras()
- wyze.getCamera(mac) — by MAC, or undefined
- wyze.getCameraByName(nickname) — by nickname (case-insensitive)
- wyze.getCameraSnapshot(mac) — cloud snapshot metadata object (or null)
- wyze.getCameraSnapshotUrl(mac) — cloud snapshot URL only
- wyze.getCameraSummaries() — summaries for all cameras
- wyze.cameraCaptureSnapshot(mac, model, [options]) — capture a JPEG frame from the live WebRTC stream. ffmpeg is provided by the bundled
ffmpeg-staticnpm dep — no system install. Cached per-mac forcacheTtlMs(default 10s). Returns aBuffer. - wyze.getCameraSnapshotImage(mac, [options]) — returns
{buffer, source}wheresourceis"cloud"or"capture". Tries the cloud thumbnail first; on missing or download failure, falls back tocameraCaptureSnapshot. PassskipCloud: trueto go straight to live capture.
- wyze.plugPower(device.mac, device.product_model, value)
- wyze.plugTurnOn(device.mac, device.product_model)
- wyze.plugTurnOff(device.mac, device.product_model)
- wyze.lightPower(device.mac, device.product_model, value)
- wyze.lightTurnOn(device.mac, device.product_model)
- wyze.lightTurnOff(device.mac, device.product_model)
- wyze.setBrightness(device.mac, device.product_model, value)
- wyze.setColorTemperature(device.mac, device.product_model, value)
- wyze.turnMeshOn(device.mac, device.product_model)
- wyze.turnMeshOff(device.mac, device.product_model)
- wyze.lightMeshPower(device.mac, device.product_model, value)
- wyze.lightMeshOn(device.mac, device.product_model)
- wyze.lightMeshOff(device.mac, device.product_model)
- wyze.setMeshBrightness(device.mac, device.product_model, value)
- wyze.setMeshColorTemperature(device.mac, device.product_model, value)
- wyze.setMeshHue(device.mac, device.product_model, value)
- wyze.setMeshSaturation(device.mac, device.product_model, value)
- wyze.wallSwitchPower(device.mac, device.product_model, value)
- wyze.wallSwitchPowerOn(device.mac, device.product_model)
- wyze.wallSwitchPowerOff(device.mac, device.product_model)
- wyze.wallSwitchIot(device.mac, device.product_model, value)
- wyze.wallSwitchIotOn(device.mac, device.product_model)
- wyze.wallSwitchIotOff(device.mac, device.product_model)
- wyze.wallSwitchLedStateOn(device.mac, device.product_model)
- wyze.wallSwitchLedStateOff(device.mac, device.product_model)
- wyze.wallSwitchVacationModeOn(device.mac, device.product_model)
- wyze.wallSwitchVacationModeOff(device.mac, device.product_model)
- wyze.lockLock(device)
- wyze.unlockLock(device)
- wyze.lockInfo(device)
- wyze.lockBoltV2GetProperties(device.mac, device.product_model)
- wyze.lockBoltV2Lock(device.mac, device.product_model)
- wyze.lockBoltV2Unlock(device.mac, device.product_model)
- wyze.palmLockGetProperties(device.mac, device.product_model)
- wyze.garageDoor(device.mac, device.product_model)
- wyze.getHmsID()
- wyze.setHMSState(hms_id, mode)
- wyze.getHmsUpdate(hms_id)
- wyze.thermostatGetIotProp(device.mac)
- wyze.thermostatSetIotProp(device.mac, device.product_model, propKey, value)
- wyze.irrigationGetDeviceInfo(device.mac)
- wyze.irrigationGetZones(device.mac)
- wyze.irrigationQuickRun(device.mac, zoneNumber, duration)
- wyze.irrigationStop(device.mac)
- wyze.irrigationGetScheduleRuns(device.mac)
- wyze.irrigationGetIotProp(device.mac)
- wyze.login()
- wyze.maybeLogin()
- wyze.refreshToken()
- wyze.getObjectList()
- wyze.getPropertyList(device.mac, device.product_model)
- wyze.setProperty(device.mac, device.product_model, propertyId, propertyValue)
- wyze.runAction(device.mac, device.product_model, actionKey)
- wyze.runActionList(device.mac, device.product_model, propertyId, propertyValue, actionKey)
- wyze.controlLock(device.mac, device.product_model, action)
- wyze.getLockInfo(device.mac, device.product_model)
- wyze.getIotProp(device.mac)
- wyze.setIotProp(device.mac, device.product_model, propKey, value)
- wyze.getUserProfile()
- wyze.disableRemeAlarm(hms_id)
- wyze.getPlanBindingListByUser()
- wyze.monitoringProfileStateStatus(hms_id)
- wyze.monitoringProfileActive(hms_id, home, away)
- wyze.iot3GetProperties(deviceMac, deviceModel, props)
- wyze.iot3RunAction(deviceMac, deviceModel, action)
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.
- wyzeapy, a Python library for the Wyze API.