jfarmer08 / homebridge-wyze-smart-home

Wyze Smart Home plugin for Homebridge.
MIT License
103 stars 17 forks source link

Using HOOBS the plugin works so long as I input my MFA before starting the bridge, but it falls over later #122

Closed ourstanley closed 1 year ago

ourstanley commented 1 year ago

Describe Your Problem: So I've updated my configuration with my API Key and Key ID and so long as I update to my current MFA just before starting the bridge (which is only running this plugin) everything works initially. But at some point the plugin starts to get errors and it fall over.

If I try to leave the MFA blank I get an error

Logs: 7/17/2023, 9:40:23 PMWyze Smart Home BridgeWyzeERRORResponse (Bad Request): {"description":"Invalid Verification Code.","requestId":"efe1a0e1-79d5-47c1-a93a-a95d4fc2d5ae","errorCode":1000} 7/17/2023, 9:40:23 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: Request failed with status code 400 7/17/2023, 9:41:24 PMWyze Smart Home BridgeWyzeERRORRequest failed: Error: Request failed with status code 400 7/17/2023, 9:41:24 PMWyze Smart Home BridgeWyzeERRORResponse (Bad Request): {"description":"Too many failed attempts. Please try again later.","requestId":"6f1bf4af-ef60-4187-85f4-6c6e932c5232","errorCode":1000} 7/17/2023, 9:41:24 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: Request failed with status code 400 7/17/2023, 9:42:24 PMWyze Smart Home BridgeWyzeERRORRequest failed: Error: Request failed with status code 400 7/17/2023, 9:42:24 PMWyze Smart Home BridgeWyzeERRORResponse (Bad Request): {"description":"Too many failed attempts. Please try again later.","requestId":"c345574a-0b2f-4c3f-aa56-79ac2db9aacd","errorCode":1000} 7/17/2023, 9:42:24 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: Request failed with status code 400 7/17/2023, 9:43:25 PMWyze Smart Home BridgeWyzeERRORRequest failed: Error: Request failed with status code 400 7/17/2023, 9:43:25 PMWyze Smart Home BridgeWyzeERRORResponse (Bad Request): {"description":"Too many failed attempts. Please try again later.","requestId":"4891a289-5e4c-4e6d-b1b0-f2d461e9a13c","errorCode":1000} 7/17/2023, 9:43:25 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: Request failed with status code 400 7/17/2023, 9:44:25 PMWyze Smart Home BridgeWyzeERRORRequest failed: Error: Request failed with status code 400 7/17/2023, 9:44:25 PMWyze Smart Home BridgeWyzeERRORResponse (Bad Request): {"description":"Too many failed attempts. Please try again later.","requestId":"9a1a94fb-4567-43c6-ae4a-dbb411b87b89","errorCode":1000} 7/17/2023, 9:44:25 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: Request failed with status code 400 7/17/2023, 9:45:25 PMWyze Smart Home BridgeWyzeERRORRequest failed: Error: Request failed with status code 400 7/17/2023, 9:45:25 PMWyze Smart Home BridgeWyzeERRORResponse (Bad Request): {"description":"Too many failed attempts. Please try again later.","requestId":"66fd3e85-5fff-4197-8a53-5579705e4d99","errorCode":1000} 7/17/2023, 9:45:25 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: Request failed with status code 400 7/17/2023, 9:46:26 PMWyze Smart Home BridgeWyzeERRORRequest failed: Error: Request failed with status code 400

Show the Homebridge logs here, remove any sensitive information.

Plugin Config:

"platform": "WyzeSmartHome",
"name": "Wyze",
"refreshInterval": 60000,
"username": "xxxxxxxxxx@gmail.com",
"password": "xxxxxxxx",
"Key ID": "xxxxxxxxxxxxx",
"API Key": "xxxxxxxxxxxxx",
"mfaCode": "xxxxxx"

} Screenshots:

Environment:

github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue

ourstanley commented 1 year ago

OK, so after I submitted this I saw that there was an update to 0.5.34 which I did and restarted the bridge. I go the same errors as above and then after a while I started to get this error:-

7/18/2023, 3:37:42 AMWyze Smart Home BridgeWyzeERRORCommon (Model: BS_WK1) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found 7/18/2023, 3:38:19 AMWyze Smart Home BridgeWyzeERRORRequest failed: Error: read ETIMEDOUT 7/18/2023, 3:38:19 AMWyze Smart Home BridgeWyzeERRORError: read ETIMEDOUT 7/18/2023, 3:38:19 AMWyze Smart Home BridgeWyzeERRORError, refreshing access token and trying again 7/18/2023, 3:38:20 AMWyze Smart Home BridgeWyzeERRORError, logging in and trying again 7/18/2023, 3:38:20 AMWyze Smart Home BridgeWyzeERRORRequest failed: Error: Request failed with status code 400 7/18/2023, 3:38:20 AMWyze Smart Home BridgeWyzeERRORResponse (Bad Request): {"description":"Invalid Verification Code.","requestId":"4be6ce44-2664-4a48-bf21-c0dfca49d9c0","errorCode":1000} 7/18/2023, 3:38:43 AMWyze Smart Home BridgeWyzeERRORCommon (Model: BS_WK1) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found

Not sure exactly how quickly after the original login that I started to get this as the 'tail' of the log only goes back to halfway through the night.

Cheers,

Mike

jfarmer08 commented 1 year ago

Can you try to remove the Wyze.json file from Persist? This might help.

ourstanley commented 1 year ago

That might be stretching my skills - I really only know ‘enough to be dangerous’Would I need to ssh into my server to do that, or is there a way that I can do that through either the HOOBS app or the HOOBS web interface?Cheers,MikeSent from my iPhoneOn Jul 18, 2023, at 10:12 AM, Farmer @.***> wrote: Can you try to remove the Wyze.json file from Persist? This might help.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

jfarmer08 commented 1 year ago

I don't know Hobbs well enough to help with that. I will look for other issues

ourstanley commented 1 year ago

OK, so I’ve managed to open Terminal and poke around the folder structure

I’ve found 3 folders seem to relate to your plugin - the content of each of these are:

@.***:/var/lib/hoobs/wyzesmarthomebridge$ ls -al total 56 drwxr-xr-x 3 root root 4096 Jul 17 22:21 . drwxrwxr-x 28 root root 4096 Jul 4 13:04 .. -rw-r--r-- 1 root root 52 Jul 17 21:53 cache -rw-r--r-- 1 root root 422 Jul 17 22:21 config.json drwxr-xr-x 96 root root 4096 Jul 17 22:20 node_modules -rw-r--r-- 1 root root 193 Jul 17 22:20 package.json -rw-r--r-- 1 root root 30717 Jul 17 22:20 yarn.lock

@.***:/var/lib/hoobs/wyzesmarthomebridge.accessories$ ls -al total 16 drwxr-xr-x 2 root root 4096 Jun 28 15:49 . drwxrwxr-x 28 root root 4096 Jul 4 13:04 .. -rw-r--r-- 1 root root 3644 Jul 17 22:22 cachedAccessories -rw-r--r-- 1 root root 3218 Jul 17 22:21 .cachedAccessories.bak

@.***:/var/lib/hoobs/wyzesmarthomebridge.persist$ ls -al total 40 drwxr-xr-x 2 root root 4096 Jun 28 13:03 . drwxrwxr-x 28 root root 4096 Jul 4 13:04 .. -rw-r--r-- 1 root root 906 Jul 17 22:22 AccessoryInfo.9C1C645177E9.json -rw-r--r-- 1 root root 25699 Jul 17 22:22 IdentifierCache.9C1C645177E9.json

I can’t find a Waze.json file anywhere, but within this folder I have found the config.schema.json - this seems to be what prompts the GUI for filling in the config, although that still doesn’t prompt to fill in the API Key or Key ID, just the MFA….

@.***:/var/lib/hoobs/wyzesmarthomebridge/node_modules/homebridge-wyze-smart-home$ ls -al total 76 drwxr-xr-x 5 root root 4096 Jul 17 22:20 . drwxr-xr-x 96 root root 4096 Jul 17 22:20 .. -rw-r--r-- 1 root root 4456 Jul 17 22:20 CHANGELOG.md -rw-r--r-- 1 root root 1320 Jul 17 22:20 configSample.json -rw-r--r-- 1 root root 3701 Jul 17 22:20 config.schema.json -rw-r--r-- 1 root root 66 Jul 17 22:20 .gitattributes drwxr-xr-x 4 root root 4096 Jul 17 22:20 .github -rw-r--r-- 1 root root 1036 Jul 17 22:20 license.txt -rw-r--r-- 1 root root 17386 Jul 17 22:20 logo.png drwxr-xr-x 3 root root 4096 Jul 17 22:20 node_modules -rw-r--r-- 1 root root 1112 Jul 17 22:20 package.json -rw-r--r-- 1 root root 4757 Jul 17 22:20 README.md drwxr-xr-x 4 root root 4096 Jul 17 22:20 src

Not sure if this helps at all…

Cheers,

Mike

On Jul 18, 2023, at 8:01 PM, Farmer @.***> wrote:

I don't know Hobbs well enough to help with that. I will look for other issues — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

mrlt8 commented 1 year ago

Plugin Config:

"platform": "WyzeSmartHome",
"name": "Wyze",
"refreshInterval": 60000,
"username": "xxxxxxxxxx@gmail.com",
"password": "xxxxxxxx",
"Key ID": "xxxxxxxxxxxxx",
"API Key": "xxxxxxxxxxxxx",
"mfaCode": "xxxxxx"

I believe it needs to be:

"keyId": "xxxxxxxxxxxxx",
"apiKey": "xxxxxxxxxxxxx",

(no spaces, camelCase)

ourstanley commented 1 year ago

Thanks, I've updated those variable names as suggested.

But it seems like I still have to input my MFA code - if I leave it blank then I get an error

7/19/2023, 9:49:27 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: Your account has 2-factor auth enabled. Please provide the "mfaCode" parameter in config.json.

But if I save the current code in the configuration along with the keyId and the apiKey then it starts up fine - I just get the error message saying that my v1 camera isn't recognized and then an error like

7/19/2023, 9:50:26 PMWyze Smart Home BridgeWyze ERROR Error getting devices: Error: ENOENT: no such file or directory, open '/var/lib/hoobs/wyzesmarthomebridge/persist/wyze-d1736ee3-20f7-43a7-b631-770b9200b08d.json'

But if I try to navigate to that folder it doesn't work - some how instead of var/lib/hoobs/wyzesmarthomebridge/persist/ it seems to be var/lib/hoobs/wyzesmarthomebridge.persist (in the screenshot folders appear as blue font)

Screenshot 2023-07-19 at 9 46 32 PM

If I go into the persist folder these are the files I find in it:-

Screenshot 2023-07-19 at 10 00 32 PM

It can't be right that I have to enter my mfa code every time I have to restart either my HOOBS server or my wyzesmarthomebridge bridge - but equally I don't want to turn off mfa on my Wyze account as I'd prefer to still use that when logging into my account with the Wyze app.

jfarmer08 commented 1 year ago

@ourstanley Can you confirm what version you are using?

Does anyone know how to install HOBBS 4 on Docker? I have never used HOBBS or tested this plugin on HOBBS>

ourstanley commented 1 year ago

I’m usingPlugin Version: 0.5.34Homebridge Version: 1.6.0I’m running HOOBS on a Raspberry Pi using the HOOBS image. When I get home I’ll send a screen grab of what the visual GUI looks like for the plug-in (it has the option to put in the MFA code, but not the keyId and apiKey - that have to be manually added in the Advanced view)Cheers,MikeSent from my iPhoneOn Jul 21, 2023, at 8:36 AM, Farmer @.***> wrote: @ourstanley Can you confirm what version you are using? Does anyone know how to install HOBBS 4 on Docker? I have never used HOBBS or tested this plugin on HOBBS>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

jfarmer08 commented 1 year ago

I just installed Hoobs 3.x and KeyID and APIKey both show in the config

ourstanley commented 1 year ago

This is what it looks like in HOOBS Version 4.2.2 (4.2.2) (the latest one for Mac) (so that's the HOOBS app for Mac - the version of HOOBS which is running on the server is version 4.3.0)

Screenshot 2023-07-21 at 5 59 49 PM (1)
mrlt8 commented 1 year ago

Same result as @jfarmer08 - NO mfa when using KeyID and APIKey in hoobs 3.

I used to use hoobs and always found it to be problematic compared to vanilla homebridge.

@ourstanley have you tried removing the wyze plugin and adding it again to see if that clears out any stale config/files?

ourstanley commented 1 year ago

I’ve uninstalled and reinstalled the plugin a few times (and once again just now), including rebooting the HOOBS server after uninstalling and before reinstalling.

Now it seems like it doesn’t want to connect with or without the MFA code - this is the log entries I get currently:

7/21/2023, 11:23:23 PM Wyze Smart Home Bridge Configuration change 7/21/2023, 11:23:23 PM wyzesmarthomebridge stopping 7/21/2023, 11:23:28 PM Wyze Smart Home Bridge starting 7/21/2023, 11:23:33 PM Wyze Smart Home Bridge Loaded plugin 'homebridge-wyze-smart-home' 7/21/2023, 11:23:33 PM Wyze Smart Home Bridge Loading 1 platforms... 7/21/2023, 11:23:33 PM Wyze Smart Home Bridge Bridge is running on port 51836. 7/21/2023, 11:23:34 PM Wyze Smart Home Bridge Wyze ERROR Request failed: Error: Request failed with status code 403 7/21/2023, 11:23:34 PM Wyze Smart Home Bridge Wyze ERROR Response (Forbidden): "" 7/21/2023, 11:23:34 PM Wyze Smart Home Bridge Wyze ERROR Error getting devices: Error: Request failed with status code 403

On Jul 21, 2023, at 9:34 PM, mrlt8 @.***> wrote:

Same result as @jfarmer08 - NO mfa when using KeyID and APIKey in hoobs 3. I used to use hoobs and always found it to be problematic compared to vanilla homebridge. @ourstanley have you tried removing the wyze plugin and adding it again to see if that clears out any stale config/files? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ourstanley commented 1 year ago

OK, so it seems like when I copy/pasted my configuration the "keyId" had been autocorrected to "keyID".

When I uninstalled and reinstalled again and made sure that the "keyId" was correct in the configuration the plugin seems to have started up OK without the need for an MFA (and that behavior survives a reboot of the HOOBS server).

When starting up the sequence of messages is:

7/21/2023, 11:44:59 PMWyze Smart Home Bridge starting 7/21/2023, 11:45:04 PMWyze Smart Home BridgeLoaded plugin 'homebridge-wyze-smart-home' 7/21/2023, 11:45:04 PMWyze Smart Home BridgeLoading 1 platforms... 7/21/2023, 11:45:04 PMWyze Smart Home BridgeBridge is running on port 51836. 7/21/2023, 11:45:05 PMWyze Smart Home BridgeWyzeERRORError getting devices: Error: ENOENT: no such file or directory, open '/var/lib/hoobs/wyzesmarthomebridge/persist/wyze-d1736ee3-20f7-43a7-b631-770b9200b08d.json' 7/21/2023, 11:46:06 PMWyze Smart Home BridgeWyzeERRORCommon (Model: BS_WK1) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found

The 2 error messages seem to repeat every minute or so - but don't seem to affect the running of the plugin

jfarmer08 commented 1 year ago

All this means is that it's not in the supported list. It should still show in HomeKit and if everything works as expected please add a request to have it added. When submitting a request I will need the type/model and description