shauntarves/wyze-sdk

Add Support for WyzeCam OG

Opened this issue · 12 comments

I'm trying to do some basic functions with my WyzeCam OG (turn on, turn off) using the SDK. The Web Client works just fine (I can list my OG using wyze_sdk.api.Client().devices_list()), but when I try to use the CamerasClient (wyze_sdk.api.Client().cameras.list()), I get nothing. I'm assuming that there is no support for the OG yet?

I've submitted pull request #151 to add it to the models list.

Hey @richt00, if you're willing to send me some debugging information, I can try to get this working. Without an OG cam myself, I'm flying a bit blind.

Please enable debug logging by adding wyze_sdk.set_stream_logger('wyze_sdk', level=logging.DEBUG) to your python script and then running a few of the commands you are trying.

Hi All,

I am also hoping that I can use this to work with my WyzeCam OG. Please do let me know if there is any additional information I can provide!

@richt00 @ConnorKneeland,

Everything seems reasonable enough in this output, though I've never seen result: 3 like is shown in the last line {'ts': 1704475883638, 'code': '1', 'msg': '', 'data': {'session_id': '', 'custom_string': None, 'action_session_id': '', 'result': 3}}.

There's a little too much noise in what you pasted for me to be sure which lines correspond to which command(s).

Can we try this: Try the "turn off" action with and without debug enabled and paste the output here directly (don't upload a text file or try to attach to an email to respond)? And then do the same for the "restart" action

Turn Off - No Debug:
{'ts': 1705952788027, 'code': '1', 'msg': '', 'data': {'session_id': '', 'custom_string': None, 'action_session_id': '', 'result': 3}}

Turn Off - Debug Enabled:
2024-01-22 14:37:53,581 [DEBUG] wyze_sdk.service.base: merging request-specific headers into session headers
2024-01-22 14:37:53,584 [DEBUG] wyze_sdk.service.base: unmodified prepared request
2024-01-22 14:37:53,585 [DEBUG] wyze_sdk.service.base: <PreparedRequest [POST]>
2024-01-22 14:37:53,585 [INFO] wyze_sdk.service.base: requesting POST to https://api.wyzecam.com/app/v2/auto/run_action
2024-01-22 14:37:53,586 [DEBUG] wyze_sdk.service.base: headers: {'User-Agent': 'okhttp/4.7.2', 'Accept-Encoding': 'gzip', 'Accept': '/', 'Connection': 'keep-alive', 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': '582'}
2024-01-22 14:37:53,586 [DEBUG] wyze_sdk.service.base: body: b'{"instance_id":"GW_GC1_D03F2771A1BB","action_key":"power_off","provider_key":"GW_GC1","sv":"011a6b42d80a4f32b4cc24bb721c9c96","action_params":{},"access_token":"lvtx.CcCOykxdmrTkN5Q7tsH9dpGV0ZiHzzLKyJmMQ+tJo+ssQFNK/y3l5i16wViTxw/jQivM4VWkwAct/92vgcrgvUfJF3h9FTvfTKxZEUVa34gsb0Xk5gCdWmUqt6qvgK/9Z5HMYoeSBUaUQqgiJnLZgcTBHH4J1yrWeHUvoID+I7f4RFWiGWxttwN4kKFaju5kWBBHMw==","app_name":"com.hualai","app_ver":"com.hualai___2.19.14","app_version":"2.19.14","phone_id":"6c54e530-522d-4612-8df4-5dceba069d61","phone_system_type":"2","sc":"a626948714654991afd3c0dbd7cdb901","ts":1705952273581}'
2024-01-22 14:37:53,588 [DEBUG] wyze_sdk.service.base: settings: {'proxies': OrderedDict(), 'stream': False, 'verify': True, 'cert': None}
2024-01-22 14:37:54,192 [DEBUG] wyze_sdk.service.wyze_response: Received the following response - status: 200
headers: {"Date": "Mon, 22 Jan 2024 19:37:54 GMT", "Content-Type": "application/json; charset=utf-8", "Content-Length": "120", "Connection": "keep-alive", "Cache-Control": "no-cache", "Pragma": "no-cache", "Expires": "-1", "Server": "Microsoft-IIS/8.5", "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Cache-Control, Accept, authorization, content-type", "Access-Control-Allow-Methods": "POST,GET,OPTIONS", "Access-Control-Allow-Origin": "*", "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET"}
body: {"ts": 1705952274174, "code": "1", "msg": "", "data": {"session_id": "", "custom_string": null, "action_session_id": "", "result": 3}}
2024-01-22 14:37:54,192 [DEBUG] wyze_sdk.service.wyze_response: response code: 1

Restart - No Debug:
{'ts': 1705958141248, 'code': '1', 'msg': '', 'data': {'session_id': '', 'custom_string': None, 'action_session_id': '', 'result': 3}}

Restart - Debug Enabled:
2024-01-22 16:12:54,488 [DEBUG] wyze_sdk.service.base: merging request-specific headers into session headers
2024-01-22 16:12:54,489 [DEBUG] wyze_sdk.service.base: unmodified prepared request
2024-01-22 16:12:54,489 [DEBUG] wyze_sdk.service.base: <PreparedRequest [POST]>
2024-01-22 16:12:54,490 [INFO] wyze_sdk.service.base: requesting POST to https://api.wyzecam.com/app/v2/auto/run_action
2024-01-22 16:12:54,490 [DEBUG] wyze_sdk.service.base: headers: {'User-Agent': 'okhttp/4.7.2', 'Accept-Encoding': 'gzip', 'Accept': '/', 'Connection': 'keep-alive', 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': '580'}
2024-01-22 16:12:54,490 [DEBUG] wyze_sdk.service.base: body: b'{"instance_id":"GW_GC1_D03F2771A1BB","action_key":"restart","provider_key":"GW_GC1","sv":"011a6b42d80a4f32b4cc24bb721c9c96","action_params":{},"access_token":"lvtx./xRMjbvFFheDHi8wB0hO4JYU9kGyAXxN35V6ZpTg+HSQZW4VcMHdp6xVqkbH56DUdmiLnJ/v8cp3jsJFRLCs0F+CwQtn08sn/bX9eWdBMTlAdK//Pv13OLxffK2gt/Tz7qx/6Bq7u7zNzqwSzqueIap4+CEWUnwkX7MITHdiNWP5em7MEU2V9r6MjhqCP8RXK6Qqgw==","app_name":"com.hualai","app_ver":"com.hualai___2.19.14","app_version":"2.19.14","phone_id":"255d3fc3-a2d6-4a07-8b6a-e5dcfb6b3d27","phone_system_type":"2","sc":"a626948714654991afd3c0dbd7cdb901","ts":1705957974488}'
2024-01-22 16:12:54,491 [DEBUG] wyze_sdk.service.base: settings: {'proxies': OrderedDict(), 'stream': False, 'verify': True, 'cert': None}
2024-01-22 16:12:55,083 [DEBUG] wyze_sdk.service.wyze_response: Received the following response - status: 200
headers: {"Date": "Mon, 22 Jan 2024 21:12:55 GMT", "Content-Type": "application/json; charset=utf-8", "Content-Length": "120", "Connection": "keep-alive", "Cache-Control": "no-cache", "Pragma": "no-cache", "Expires": "-1", "Server": "Microsoft-IIS/8.5", "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Cache-Control, Accept, authorization, content-type", "Access-Control-Allow-Methods": "POST,GET,OPTIONS", "Access-Control-Allow-Origin": "*", "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET"}
body: {"ts": 1705957975003, "code": "1", "msg": "", "data": {"session_id": "", "custom_string": null, "action_session_id": "", "result": 3}}
2024-01-22 16:12:55,083 [DEBUG] wyze_sdk.service.wyze_response: response code: 1

The list_devices command was very verbose when I turned on debug, but the last line was this:
!!! Camera's constructor args (mac, first_activation_ts, first_binding_ts, enr, nickname, timezone_name, product_model, product_model_logo_url, hardware_ver, firmware_ver, user_role, binding_user_nickname, conn_state, conn_state_ts, push_switch, device_params, is_in_auto, event_master_switch, parent_device_mac, parent_device_enr, binding_ts, timezone_gmt_offset) were ignored. If they should be supported by this library, report this issue to the project https://github.com/shauntarves/wyze-sdk/issues

Could this be the issue?

That is just a disclaimer and not an error.

I have been working on the streaming part of the OG cams, and am close to a solution that I will be able to share. It is kinda hacked together however so it will absolutely be a YMMV.

@mcduffman just seeing this update but super interested. I started a project to enable video streaming from Gwell IotVideo based Wyze cameras which include the OG Cam, Video Doorbell Pro and maybe others. I am wondering what your approach has been and if you have a repo you can link to? My project is here: Cryze

Hope we can work together on this and support pushing this forward!