Skip to content

mackenly/docker-wyze-plug-api

Repository files navigation

docker-wyze-plug-api

A docker container containing an API for interacting with Wyze Plugs

📝 As of July 2023, Wyze now requires an API_KEY and KEY_ID from the Developer API Console (see below) to be passed with all requests. If you were using this tool before then you'll need to update your container. This key/id expires every year so you'll have to manually update it for now.

Overview

The following gives a brief overview of this simple project and shows how to get started, and if something doesn't make sense, the code is very simple.

Big thank you to Shaun Tarves and all the contributors to the wyze-sdk project, which powers the backend of this project. Unfortunately Wyze doesn't have an official API, so this is the best we have for now.

An overview of the Docker variables used:

  • USERNAME: Your Wyze username
  • PASSWORD: Your Wyze password
  • API_KEY: The API key given to you by Wyze from the Developer API Console, it will only show once, so make sure you save it. Note: This is not the same as the KEY which is used to authenticate incoming requests to your API.
  • KEY_ID: The KEY ID given to you by Wyze from the Developer API Console
  • TOTP: The totp key given to you by Wyze when you configure an authenticator app (this program acts like an authenticator app, don't worry you can still use your authenticator app)
  • ALWAYS_REFRESH: Always refresh the token each time a request is made? Defaults to True. (optional)
  • KEY: A short key used to authenticate incoming requests to provide a small amount of security. Defaults to "mykey". (optional)

Authentication

  • If you use 2FA, you'll need to get a TOTP key from the Wyze. Once you get your TOTP key, you can pass it into your docker image to start the API.
💁‍♂️ Not sure what a TOTP key is? It's okay, I was wasn't sure at first either. The TOTP key is the key given to you by Wyze when you configure an authenticator app. If you've already configured 2FA using an authenticator app you may be able to view the code from within the app or (like me) you may have to disable the authenticator app method and reconfigure it. 
  • If you don't use 2FA, please configure it and follow the above steps. It's a good idea to use 2FA for any account that supports it so I've made the decision not to support non-2FA accounts for this project.

Making Requests

The API is configured to run on port 5000. You'll also need to pass in a KEY variable or use the default "mykey". This key should be passed with each request to the server within a parameter called "key" as a basic authentication method. I choose to use a parameter rather than a header because my use case only allows me to send GET requests to URLs, not allowing for including headers. Ideally, this should only be run locally, so only your local network traffic would be able to intercept your key. If that's a concern, this project probably isn't a good choice for you, so feel free to fork and modify it to better fit your needs.

There's a total of 3 endpoints available:

Links