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")
#
# # 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.17.tar.gz
(8.8 kB
view details)
Built Distribution
File details
Details for the file wyzeapy-0.0.17.tar.gz
.
File metadata
- Download URL: wyzeapy-0.0.17.tar.gz
- Upload date:
- Size: 8.8 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.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89ccaeaad443822449785de79b4e23d62108071d6b4123733e9babdaa93a14e0 |
|
MD5 | 62a5cdbb4311ed6a3962d624d77a2be2 |
|
BLAKE2b-256 | 92bc66f2b2ba44b2080fa8f7cc208533d809be04a8149075a2abd0a4874a7f8b |
File details
Details for the file wyzeapy-0.0.17-py3-none-any.whl
.
File metadata
- Download URL: wyzeapy-0.0.17-py3-none-any.whl
- Upload date:
- Size: 9.1 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.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 385db2513c04d756924bd5f7f0b0aedb64cffd7d27a59eea8f3547657c85723b |
|
MD5 | 4ff8a8542a5da20c3c0f4be234e1dbd4 |
|
BLAKE2b-256 | 4f6095bce6e40057e5232d2972b6482ca5c80a32c0ecec16a1fbf91425f3b01e |