wyze-sdk icon indicating copy to clipboard operation
wyze-sdk copied to clipboard

Access to Rules

Open EdLipson5117 opened this issue 4 years ago • 3 comments

Is there a way to access the Rules used with a device? I've been searching and not finding any methods which access rules or properties of devices where rules are specified.

EdLipson5117 avatar Aug 31 '21 19:08 EdLipson5117

There is not currently a means for that, but something I would love to add. Keep this issue open as an enhancement request and I'll get to it soon!

On Tue, Aug 31, 2021 at 3:17 PM EdLipson5117 @.***> wrote:

Is there a way to access the Rules used with a device? I've been searching and not finding any methods which access rules or properties of devices where rules are specified.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shauntarves/wyze-sdk/issues/40, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEDBMELWEZXGKG4P7ZIWTTT7UTFLANCNFSM5DEZMRWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

shauntarves avatar Aug 31 '21 20:08 shauntarves

I don't know enough about github to add that label.

EdLipson5117 avatar Sep 01 '21 11:09 EdLipson5117

BUMB Made an attempt, but competence in Python is to weak. Get a 1001 or 1004 error...

Step 1 - List rules

https://wyze-re-rule-svc.wyzecam.com/wyzeapp/cre/rules/search 
content-type:	application/json
appid:	9319141212m2ik
appinfo:	wyze_ios_2.26.21
accept:	*/*
requestid:	5ecc4cc4c4d59ed6bbc96a1fc1af6e72
accept-language:	sv-SE;q=1
accept-encoding:	gzip, deflate, br
content-length:	86
user-agent:	wyze_ios/2.26.21 (iPad Mini 4 (WiFi); iOS 14.8; Scale/2.0; Height/2048.0; Width/1536.0)
signature2:	68a0a650fe5304c6c7664a4a68990ee5
phoneid:	CA8CDAF5-79E9-4DBB-AA9B-D159103FDF4F
access_token:	lvtx.mN4cmOlKdhIJo37B5SZxIjAHtMKd/dsH6JdMf8lImx4MZYH7fE4e8oD+xedhsjRPMWggIYng4WIC9Mb+l+EM/xMzQy6lyaBd+nRR7+XWyZKc6JrS7EjOH0BGMa2e5VR4atd2Uu/O0je2Mr163VfLJStMNVLsgJYkjsjubgmMEcmdDz39vMMZ04V3gRugD99kgIUf7A==

{
    "deviceId": "",
    "nonce": "1637995983821",
    "scopes": [
        "APP"
    ],
    "secondScopes": [
        ""
    ],
    "type": ""
}

In my attempts, I either get a 1001 (Invalid parameter) or 1004 (Signature2 is invalid). In the response to the app, a list of Rules are returned:

{
    "code": 1,
    "message": "Success",
    "isShowToast": 0,
    "toastMsg": null,
    "data": [{
            "id": "10c3167ffb98428e98c709d5297cf610",
            "name": "test rule 1"
...
        }, {
            "id": "89e7eb5f4a7c4be0bf2fe635970f2e15",
            "name": "test rule 2",
...

Step 2 - Execute a rule A rule is then executed via this command according to the logs:

https://wyze-re-rule-svc.wyzecam.com/wyzeapp/cre/rules/quick_run/ 
content-type:	application/json
appid:	9319141212m2ik
appinfo:	wyze_ios_2.26.21
accept:	*/*
requestid:	ebf8acb9559100c09276e2c792c740c0
accept-language:	sv-SE;q=1
accept-encoding:	gzip, deflate, br
content-length:	118
user-agent:	wyze_ios/2.26.21 (iPad Mini 4 (WiFi); iOS 14.8; Scale/2.0; Height/2048.0; Width/1536.0)
signature2:	f487d44cf864780fd627103d6fc785cc
phoneid:	CA8CDAF5-79E9-4DBB-AA9B-D159103FDF4F
access_token:	lvtx.mN4cmOlKdhIJo37B5SZxIjAHtMKd/dsH6JdMf8lImx4MZYH7fE4e8oD+xedhsjRPMWggIYng4WIC9Mb+l+EM/xMzQy6lyaBd+nRR7+XWyZKc6JrS7EjOH0BGMa2e5VR4atd2Uu/O0je2Mr163VfLJStMNVLsgJYkjsjubgmMEcmdDz39vMMZ04V3gRugD99kgIUf7A==
{
    "distance": 0,
    "geo": {
        "latitude": 0,
        "longitude": 0
    },
    "nonce": "1637996091338",
    "sceneId": "89e7eb5f4a7c4be0bf2fe635970f2e15"
}

I hope my short scribblings and logs can support the implementation of Rules.

Any tips and tricks how to get it running, then I can make my own attempt.

/M

faanskit avatar Nov 28 '21 13:11 faanskit