Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Wyzeapy to be compatible with Wyze Sensors (old model) #5

Closed
wants to merge 38 commits into from

Conversation

faanskit
Copy link
Contributor

Updated Wyzeapy to be compatible with Wyze Sensors (old model).
And fixed #4

Joshua Mulliken and others added 30 commits April 3, 2021 20:04
See: SecKatie/ha-wyzeapi#126 (comment)

Why: In order to fix a crash where headphones were not recognized as a valid device type

How: Add headphones to the DeviceTypes enum in base_client.py
Why: To be able to create motion sensors by using the cameras for use in Home Assistant automations

How: By using the get_event_list endpoint we can get all the events for a particular device. This allows us to know the last time a motion event was fired for a camera.
See: SecKatie/ha-wyzeapi#135

Thank to [KevinVoell](https://github.com/KevinVoell) for providing direction on how to implement signing code.
This change is being made in accordance with the following user story:

As a resident in the house, I want to be able to use a physical switch to turn on and turn off the cameras when I enter or leave the house so that I can easily turn on and turn off camera supervision and feel safe when I am away and private when I am home.

Please see: Github pull request SecKatie/ha-wyzeapi#153
@CLAassistant
Copy link

CLAassistant commented May 10, 2021

CLA assistant check
All committers have signed the CLA.

@faanskit
Copy link
Contributor Author

The SonarCloud check failing on code I did not touch in this PR. I will not fix this supposed error.

@SecKatie
Copy link
Owner

The SonarCloud check failing on code I did not touch in this PR. I will not fix this supposed error.

No worries it was changed in the master, so we will just have to make sure the merge happens correctly. SonarCloud is not the best but it is free haha

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug C 2 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@faanskit
Copy link
Contributor Author

Sample code for turning notifications on/off

These variants work

  • NOTIFICATIONS
  • MOTION_NOTIFICATION
  • SOUND_NOTIFICATION
from wyzeapy.base_client import AccessTokenError, DeviceTypes, Device, PropertyIDs, ActionNotSupported, Group, EventTypes
from wyzeapy.client import Client
import sys

if __name__ == '__main__':
    if len(sys.argv) == 2:
        wyze_client = Client("username", "password")
        devices = wyze_client.get_devices()
        for device in devices:
            device_type: DeviceTypes = DeviceTypes(device.product_type)
            if device_type == DeviceTypes.CAMERA:
                if sys.argv[1] == "off":
                    device_info = wyze_client.notifications_off(device, PropertyIDs.NOTIFICATIONS)
                elif sys.argv[1] == "on":
                    device_info = wyze_client.notifications_on(device, PropertyIDs.NOTIFICATIONS)

@SecKatie
Copy link
Owner

Hey @faanskit can you update this to fit the current project?

@faanskit
Copy link
Contributor Author

Hey @faanskit can you update this to fit the current project?

Sure, but it will take some time before I can do it. Do not have access to a dev enviroment for a few weeks and have not followed what changes has been made.

@SecKatie
Copy link
Owner

No worries! Whenever you get a chance

@SecKatie SecKatie force-pushed the main branch 3 times, most recently from 338e402 to 56a3bed Compare September 26, 2021 22:16
@SecKatie SecKatie closed this Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wyzeapy time related code not transportable and get_event_list possibly have a design flaw
3 participants