Skip to main content

Python client for private Wyze API

Project description

How to use

Example code:

from src.wyzeapy import Client, ActionNotSupported, PropertyIDs
from src.wyzeapy import AccessTokenError

# Testing what happens when not logged in
# try:
#     wyze_client.get_object_list()
# except ParameterError as e:
#     print(e)
#
# wyze_client.login("jocoder6@gmail.com", "7PRgKbiVUa.ZYk4tw@b@ij") # Don't worry it is an old password
#
# # Testing what happens when access token is bad
# try:
#     wyze_client.access_token = "BAD"
#     wyze_client.get_object_list()
# except AccessTokenError as e:
#     print(e)
#
# wyze_client.login("jocoder6@gmail.com", "7PRgKbiVUa.ZYk4tw@b@ij")
#
# for device in wyze_client.get_object_list():
#     try:
#         wyze_client.run_action_list(device, [
#             {"pid": PropertyIDs.ON.value, "pvalue": "0"},
#             {"pid": PropertyIDs.COLOR.value, "pvalue": "FF0000"}
#         ])
#     except ActionNotSupported as e:
#         print(e)
#
#     try:
#         wyze_client.set_property_list(device, [
#             {"pid": PropertyIDs.ON.value, "pvalue": "0"},
#             {"pid": PropertyIDs.BRIGHTNESS.value, "pvalue": "100"}
#         ])
#     except ActionNotSupported as e:
#         print(e)
#
#     try:
#         wyze_client.set_property(device, PropertyIDs.ON.value, "0")
#     except ActionNotSupported as e:
#         print(e)

if __name__ == '__main__':
    """Documentation on how to use the code"""
    wyze_client = Client("USERNAME", "PASSWORD")
    devices = wyze_client.get_devices()
    for device in devices:
        wyze_client.get_info(device)
        try:
            wyze_client.turn_on(device, [
                wyze_client.create_pid_pair(PropertyIDs.COLOR_TEMP, str(6500))
            ])
        except ActionNotSupported:
            pass
        # print("{} {} {}".format(device.product_type, device.mac, wyze_client.get_info(device)))
    # for device in devices:
    #     try:
    #         # wyze_client.turn_on(device, [
    #         #     wyze_client.create_pid_pair(PropertyIDs.COLOR, "FF0000"),
    #         #     wyze_client.create_pid_pair(PropertyIDs.BRIGHTNESS, str(25))
    #         # ])
    #         wyze_client.turn_off(device)
    #     except ActionNotSupported as e:
    #         print("{} {}".format(type(e), e))
    #     except AccessTokenError as e:
    #         wyze_client.reauthenticate()
    #         wyze_client.turn_off(device)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wyzeapy-0.0.23b2.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

wyzeapy-0.0.23b2-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file wyzeapy-0.0.23b2.tar.gz.

File metadata

  • Download URL: wyzeapy-0.0.23b2.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for wyzeapy-0.0.23b2.tar.gz
Algorithm Hash digest
SHA256 c6b89ac2ed7914e9b135ca4d176db054a04dd313ea136a73d732fba601a6c939
MD5 a0b7857c4e62efe6d7f88ec707fc927e
BLAKE2b-256 b45f16c8e02cb2d815dd46baed4970dedddbc2de8566fb2c74bf855f6b2d6350

See more details on using hashes here.

File details

Details for the file wyzeapy-0.0.23b2-py3-none-any.whl.

File metadata

  • Download URL: wyzeapy-0.0.23b2-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for wyzeapy-0.0.23b2-py3-none-any.whl
Algorithm Hash digest
SHA256 b5d08cdfcffa854c9fecb41b6c97ff6647b72b236018e2b471be5811e743ceff
MD5 10e2e975e62a2d46b2bd5e6d445c39ac
BLAKE2b-256 8c11de2181c91b36903bdf3ded3cb6cea68bc74fe7efc9bece9a43d7d8307e22

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page