# How to use
Example code:
```python
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/JoshuaMulliken/wyzeapy",
"name": "wyzeapy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Mulliken LLC",
"author_email": "joshua@mulliken.net",
"download_url": "https://files.pythonhosted.org/packages/26/fd/e50a15af33a7561011e65ac737fd3600117237b902c28e10f8197dc61b01/wyzeapy-0.0.15.tar.gz",
"platform": "",
"description": "# How to use\n\nExample code:\n```python\nfrom src.wyzeapy import Client, ActionNotSupported, PropertyIDs\nfrom src.wyzeapy import AccessTokenError\n\n# Testing what happens when not logged in\n# try:\n# wyze_client.get_object_list()\n# except ParameterError as e:\n# print(e)\n#\n# wyze_client.login(\"jocoder6@gmail.com\", \"7PRgKbiVUa.ZYk4tw@b@ij\")\n#\n# # Testing what happens when access token is bad\n# try:\n# wyze_client.access_token = \"BAD\"\n# wyze_client.get_object_list()\n# except AccessTokenError as e:\n# print(e)\n#\n# wyze_client.login(\"jocoder6@gmail.com\", \"7PRgKbiVUa.ZYk4tw@b@ij\")\n#\n# for device in wyze_client.get_object_list():\n# try:\n# wyze_client.run_action_list(device, [\n# {\"pid\": PropertyIDs.ON.value, \"pvalue\": \"0\"},\n# {\"pid\": PropertyIDs.COLOR.value, \"pvalue\": \"FF0000\"}\n# ])\n# except ActionNotSupported as e:\n# print(e)\n#\n# try:\n# wyze_client.set_property_list(device, [\n# {\"pid\": PropertyIDs.ON.value, \"pvalue\": \"0\"},\n# {\"pid\": PropertyIDs.BRIGHTNESS.value, \"pvalue\": \"100\"}\n# ])\n# except ActionNotSupported as e:\n# print(e)\n#\n# try:\n# wyze_client.set_property(device, PropertyIDs.ON.value, \"0\")\n# except ActionNotSupported as e:\n# print(e)\n\nif __name__ == '__main__':\n \"\"\"Documentation on how to use the code\"\"\"\n wyze_client = Client(\"USERNAME\", \"PASSWORD\")\n devices = wyze_client.get_devices()\n for device in devices:\n wyze_client.get_info(device)\n try:\n wyze_client.turn_on(device, [\n wyze_client.create_pid_pair(PropertyIDs.COLOR_TEMP, str(6500))\n ])\n except ActionNotSupported:\n pass\n # print(\"{} {} {}\".format(device.product_type, device.mac, wyze_client.get_info(device)))\n # for device in devices:\n # try:\n # # wyze_client.turn_on(device, [\n # # wyze_client.create_pid_pair(PropertyIDs.COLOR, \"FF0000\"),\n # # wyze_client.create_pid_pair(PropertyIDs.BRIGHTNESS, str(25))\n # # ])\n # wyze_client.turn_off(device)\n # except ActionNotSupported as e:\n # print(\"{} {}\".format(type(e), e))\n # except AccessTokenError as e:\n # wyze_client.reauthenticate()\n # wyze_client.turn_off(device)\n\n```\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Python client for private Wyze API",
"version": "0.0.15",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9b02e3079fcb5a68b6c7d51695bb3dfe",
"sha256": "43c94bb26a05f08889461c52b3616d7b43ebc81ee9bd323f58326ae2fbfee564"
},
"downloads": -1,
"filename": "wyzeapy-0.0.15-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b02e3079fcb5a68b6c7d51695bb3dfe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8517,
"upload_time": "2021-04-10T20:38:31",
"upload_time_iso_8601": "2021-04-10T20:38:31.541275Z",
"url": "https://files.pythonhosted.org/packages/d0/1e/80ff18421a2f7f0893f91065083f23be63652d4c0c813195f8ee7c9fbb54/wyzeapy-0.0.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "ca85eebb4f35d779673a17be9239ae9b",
"sha256": "e8f578927e1af11e43c48b3305b4f059523dd5331f6c8cd9b190e977540253ba"
},
"downloads": -1,
"filename": "wyzeapy-0.0.15.tar.gz",
"has_sig": false,
"md5_digest": "ca85eebb4f35d779673a17be9239ae9b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 8064,
"upload_time": "2021-04-10T20:38:32",
"upload_time_iso_8601": "2021-04-10T20:38:32.782934Z",
"url": "https://files.pythonhosted.org/packages/26/fd/e50a15af33a7561011e65ac737fd3600117237b902c28e10f8197dc61b01/wyzeapy-0.0.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-04-10 20:38:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": null,
"github_project": "JoshuaMulliken",
"error": "Could not fetch GitHub repository",
"lcname": "wyzeapy"
}