Closed danfratamico closed 4 months ago
@Flyinace2000 Did you restart Homebridge after making both changes? You shouldn't need to add the line for mfaCode.
These steps from @WillFulmer work for me, however I still get some odd errors in the log. Was wondering if updating the files here with these fixes would be worth while? Or does this just mask some underlying issues with the Wyze API?
here is my log output:
[03/02/2024, 09:46:53] [Wyze] Initializing WyzeSmartHome platform...
[03/02/2024, 09:46:54] [Wyze] Error: access token is error
at WyzeAPI._performRequest (/usr/local/lib/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:132:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at WyzeAPI.request (/usr/local/lib/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:80:14)
at WyzeAPI.getObjectList (/usr/local/lib/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:234:20)
at WyzeSmartHome.refreshDevices (/usr/local/lib/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:101:26)
at WyzeSmartHome.runLoop (/usr/local/lib/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:90:9)
[03/02/2024, 09:46:54] [Wyze] Error, refreshing access token and trying again
[03/02/2024, 09:46:54] [Wyze] Error, logging in and trying again
Just to provide some assistance for those still struggling.
Same experience here:
Received email from Wyze "Wyze reset your Wyze account password on 1/31/24"
Then this plugin, due to API calls, broke:
The 2 fixes as identified above was changing two items and it started working for me.
JSON File Config:
Adding this:
And the modification of the index.js file:
@Flyinace2000 Did you restart Homebridge after making both changes? You shouldn't need to add the line for mfaCode.
Yes, added the line for MFA in the config and restarted. I just removed and restarted again to see if that helps. Remind me, how to is promo for the MFA pin?
Logs
[2/3/2024, 10:57:45 AM] [Wyze] Error: access token is error at WyzeAPI._performRequest (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:132:15) at processTicksAndRejections (node:internal/process/task_queues:95:5) at WyzeAPI.request (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:80:14) at WyzeAPI.getObjectList (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:234:20) at WyzeSmartHome.refreshDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:101:26) at WyzeSmartHome.runLoop (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:90:9) [2/3/2024, 10:57:45 AM] [Wyze] Error, refreshing access token and trying again [2/3/2024, 10:57:45 AM] [Wyze] Error, logging in and trying again [2/3/2024, 10:57:45 AM] [Wyze] Request failed: AxiosError: Request failed with status code 403 [2/3/2024, 10:57:45 AM] [Wyze] Response PerformRequest ([object Object]): "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n<TITLE>ERROR: The request could not be satisfied</TITLE>\n</HEAD><BODY>\n<H1>403 ERROR</H1>\n<H2>The request could not be satisfied.</H2>\n<HR noshade size=\"1px\">\nRequest blocked.\nWe can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.\n<BR clear=\"all\">\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\n<BR clear=\"all\">\n<HR noshade size=\"1px\">\n<PRE>\nGenerated by cloudfront (CloudFront)\nRequest ID: axz4ag60_nBH-RQpGnaI2TcQUuItc-Dc_-AiXM3CCZQrLf9HFQPvLg==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>" [2/3/2024, 10:57:45 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 403
i ran the fix and seems the only issue is homebridge not able to receive the device info (current state)
There is a PR upstream to fix this @ https://github.com/jfarmer08/wyze-api/pull/3
For those not able to match the line numbers, look for the async _performRequest()
method, or check this file for reference: https://github.com/jfarmer08/wyze-api/pull/3/files#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556
In my Hyper-V install, the location for the packaged wyze-api
was slightly different (index.js was inside the src folder & also reported first here - https://github.com/jfarmer08/homebridge-wyze-smart-home/issues/208#issuecomment-1924428513).
Adding this for others, to update from the Homebridge UI on a Hyper-V / Docker install, open Terminal from the menu and enter:
nano /var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js
The fix can be found up here: https://github.com/jfarmer08/homebridge-wyze-smart-home/issues/208#issuecomment-1924396748
Now, if you're still running into auth errors, try restarting the container first. If you suspect an old token being used, check the persist
folder for wyze-<uuid>.json
files & update/delete them.
e.g.
ls /var/lib/homebridge/persist | grep 'wyze-'
Thank you everyone for your help on this!
i ran the fix and seems the only issue is homebridge not able to receive the device info (current state)
your error shows "SUCCESS"
indicating that the fix was not applied. Try restarting the container or the machine you're running Homebridge on.
+1 Same issue here
ran the fix as @WillFulmer outlined and i'm back up! thanks everyone for the help here!
Assuming all of your files are configured in the same way mine were, if you update this file
/usr/lib/node_modules/homebridge-wyze-smart-home/src/wyze-api/index.js
and adjust line 131From this:
131 if (result.data.msg == "DeviceIsOffline") { return result } else
To this:
131 if (result.data.msg == "DeviceIsOffline" || result.data.msg == "SUCCESS") { return result } else
It appears to work without errors, I am guessing the previous API has changed slightly and it now always returns a
msg
field in the response data.This would strictly be a temporary fix until the upstream
wyze-api
package can be updated.
This worked perfectly, thanks to you and @WillFulmer! Was worried I was gonna have to buy a bunch of new bulbs.
i´m having the same issue but im on a mac, how can i access the Index.js?
To those struggling with the above, one point that's not obvious. The index.js file that needs to be edited is not quite clear there are a lot of these files!
The one you want (at least on a Mac) is at /usr/local/lib/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js
With these two changes:
if (result.data.msg == "DeviceIsOffline" || result.data.msg == "SUCCESS") { return result } else
things are again working for me. However I am NOT using 2FA – there may be additional issues (?) for such people.
I think I edited this correctly.
Also removed the wyze related files from the persist folder.
I am using MFA.
@rowrowtheboat - see post below…
https://github.com/jfarmer08/homebridge-wyze-smart-home/issues/208#issuecomment-1924774779
but try the nano editor, I wasn’t able to make it work with vi.
Once you get into the right directory for your configuration try this command:
sudo nano 131+ index.js
and it should jump you right to line 131 to make the changes.
If you're using the homebridge raspberry pi os then the path is /var/lib/homebridge/node_modules
On alpha-7
otherwise line 131 is not the same. Duh!
Also, why alpha-4 said 'remove MFA support'.
Anyway, i've updated line 131 mentioned.
I also had to use delete /var/lib/homebridge/persist/wize-..
files, add new mfaCode, restart bridge. Seems to get back my 'switch' in homekit now and now error.
Camera UI next with wyze-bridge in HASS. Different problem but probably similar fix :-(
Thank you all here!
This fix worked for me as well on synology, I closed the ticket I had opened with the same error since this this one is getting more play for the same issue.
directory for me was in /volume1/homebridge
Thanks for the fix guys! It worked just fine
Assuming all of your files are configured in the same way mine were, if you update this file
/usr/lib/node_modules/homebridge-wyze-smart-home/src/wyze-api/index.js
and adjust line 131From this:
131 if (result.data.msg == "DeviceIsOffline") { return result } else
To this:
131 if (result.data.msg == "DeviceIsOffline" || result.data.msg == "SUCCESS") { return result } else
It appears to work without errors, I am guessing the previous API has changed slightly and it now always returns a
msg
field in the response data.This would strictly be a temporary fix until the upstream
wyze-api
package can be updated.
This and the user agent change got me fixed up. Thank you!
@anderfrank you could do something like this, I believe this will work, though I do not have an older version at hand to test.
if (result.data.msg && result.data.msg != "SUCCESS")
This didn't seem to work for version 0.5.36 as I cant use the newer version because that version doesn't detect my wyze outdoor v2 cams. But the older version does...
The newer version works fine with the fix, but sadly I cant use my outdoor cams....
Hi, pals, i'm new to Homebridge (less than 48 hours in)
i just fixed the Wyze plug in and all my devices just showed up for the first time, dumb question but, is this plug in only for switches or is it to see the feeds of cameras? because all my cameras just appear as switches.
thanks
Hi, pals, i'm new to Homebridge (less than 48 hours in)
i just fixed the Wyze plug in and all my devices just showed up for the first time, dumb question but, is this plug in only for switches or is it to see the feeds of cameras? because all my cameras just appear as switches.
thanks
I have ffmpeg bridge setup to read wyze-bridge. This exposed to homekit i can see the feed of the cameras. If you add 'camera ui', you'll get exposed wvn the motion detected in homekit! This community is awesome!
+1, same problem. Tried the fixes mentioned here, wasted two hours of my life, ended up just breaking things even more and giving up. If you eff up this hard too, reinstalliing the plugin brought me back to the error I was getting before
Same, running in docker on Synology NAS. Tried the above and no changes; same errors.
I'm using a Docker container on my Synology, and after applying the fix, it seems to be able to authenticate and gets the device list, but now it crashes and forces a restart. I'm in a restart loop now. These are the errors:
[2/4/2024, 10:24:12 AM] TypeError: Cannot set properties of undefined (setting 'onoff_line')
at WyzeLock.lockGetProperty (/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:368:66)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
[2/4/2024, 10:24:12 AM] Got SIGTERM, shutting down Homebridge...
[2/4/2024, 10:25:07 AM] TypeError: Cannot read properties of undefined (reading 'switch_state')
at WyzeLock.update (/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:256:49)
at WyzeSmartHome.loadDevice (/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:154:17)
at WyzeSmartHome.loadDevices (/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:114:36)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at WyzeSmartHome.refreshDevices (/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:103:7)
at WyzeSmartHome.runLoop (/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:87:9)
after making that changes mentioned above i'm getting these errors now.
/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:227 this.log.error(
[${device.product_type}] Error removing accessory ${homeKitAccessory.context.nickname} (MAC: ${homeKitAccessory.context.mac}) : ${error}
) ^ ReferenceError: device is not defined at WyzeSmartHome.configureAccessory (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:227:28) at /var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:328:25 at Array.filter () at BridgeService.restoreCachedPlatformAccessories (/var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:288:69) at ChildBridgeFork.startBridge (/var/lib/homebridge/node_modules/homebridge/src/childBridgeFork.ts:186:24)
Hi, pals, i'm new to Homebridge (less than 48 hours in)
i just fixed the Wyze plug in and all my devices just showed up for the first time, dumb question but, is this plug in only for switches or is it to see the feeds of cameras? because all my cameras just appear as switches.
thanks
I exclude all my cameras from the Homebridge plug-in and use Wyze docker bridge with scrypted to view them in HomeKit. Just another option to the one mentioned above
i am on a pi 5 and using the latest homebridge/homebridge docker image. upgraded the plugin to v0.5.37-alpha.7. modified line 131 but getting the following error -
[2/4/2024, 12:09:55 PM] [WyzeSmartHome] Error: SUCCESS
at WyzeAPI._performRequest (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:132:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at WyzeAPI.request (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:80:14)
at WyzeAPI.getObjectList (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:234:20)
at WyzeSmartHome.refreshDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:101:26)
at WyzeSmartHome.runLoop (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:90:9)
[2/4/2024, 12:09:55 PM] [WyzeSmartHome] Error, refreshing access token and trying again
[2/4/2024, 12:09:55 PM] [WyzeSmartHome] Error, logging in and trying again
[2/4/2024, 12:09:56 PM] [WyzeSmartHome] Error getting devices: Error: SUCCESS
update: i dont know what i did. but i downgrade back to v0.5.36 (as alpha.7 doesnt work for me) and it works again. i can see my light bulbs, led strip, smart plugs. but i do get error in the homebridge log though -
[2/4/2024, 12:19:58 PM] [WyzeSmartHome] Error: SUCCESS
at WyzeAPI._performRequest (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyz-api/index.js:128:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at WyzeAPI.request (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyz-api/index.js:75:14)
at WyzeAPI.getObjectList (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyz-api/index.js:232:20)
at WyzeSmartHome.refreshDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:96:26)
at WyzeSmartHome.runLoop (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:85:9)
[2/4/2024, 12:19:58 PM] [WyzeSmartHome] Error, refreshing access token and trying again
[2/4/2024, 12:19:59 PM] [WyzeSmartHome] Error, logging in and trying again
Farmer APIKey and KEYID
[2/4/2024, 12:19:59 PM] [WyzeSmartHome] Error getting devices: Error: SUCCESS
[2/4/2024, 12:21:00 PM] [WyzeSmartHome] Error: SUCCESS
at WyzeAPI._performRequest (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyz-api/index.js:128:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at WyzeAPI.request (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyz-api/index.js:75:14)
at WyzeAPI.getObjectList (/homebridge/node_modules/homebridge-wyze-smart-home/src/wyz-api/index.js:232:20)
at WyzeSmartHome.refreshDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:96:26)
at WyzeSmartHome.runLoop (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:85:9)
[2/4/2024, 12:21:00 PM] [WyzeSmartHome] Error, refreshing access token and trying again
[2/4/2024, 12:21:00 PM] [WyzeSmartHome] Error, logging in and trying again
Farmer APIKey and KEYID
[2/4/2024, 12:21:01 PM] [WyzeSmartHome] Error getting devices: Error: SUCCESS
So I’ve tried all the fixes listed above and I’m now getting a 400 error saying that I’ve had too many failed logins. Any idea how long I need to wait before trying to login again?
So I’ve tried all the fixes listed above and I’m now getting a 400 error saying that I’ve had too many failed logins. Any idea how long I need to wait before trying to login again?
I'm going to turn off HomeBridge (running as a Docker in UnRaid) and try it in the morning giving it about 12 hours downtime.
It appears v0.5.38 released a few mins ago by @jfarmer08 resolved the issue. Letting it bake and then heading over to the donation portal. Appreciate the quickness in pushing a fix 🙌🏻
username/password is a requirement from Wyze.
@jfarmer08 thanks so much for getting a new update out so quickly. For some reason every time I try and put my lights in (they only show up on the mesh light device type) it crashes the whole Homebridge.
Change the color of the light outside of Homebridge using the WyZe App. I cannot tell which light is causing the issue, but homebridge has a null value set. You can also clear the accessory cache for homebridge in which it should boot. This is a known issue and I will try and get a fix out soon.
It appears v0.5.38 released a few mins ago by @jfarmer08 resolved the issue. Letting it bake and then heading over to the donation portal. Appreciate the quickness in pushing a fix 🙌🏻
+1 confirming this restores functionality. That said, I did get this message at plugin initialization after Homebridge restarted.
@jfarmer08 lastest version v0.5.39
boots up super clean (no error) running homebridge docker on my pi5. thanks for the quick update.
v0.5.39 fix me as well (2FA and everything)
Will the update overwrite and fix the manual changes I made to get everything back up?
Will the update overwrite and fix the manual changes I made to get everything back up?
The only change that should survive the update is the update to the config json, (adding the user agent). I guess we should remove that?
Can confirm v0.5.39 is working.
I can report the same - appreciate the work to correct this
@jfarmer08 lastest version
v0.5.39
boots up super clean (no error) running homebridge docker on my pi5. thanks for the quick update.
Hi, pals, i'm new to Homebridge (less than 48 hours in) i just fixed the Wyze plug in and all my devices just showed up for the first time, dumb question but, is this plug in only for switches or is it to see the feeds of cameras? because all my cameras just appear as switches. thanks
One thing to remember is that even if you can't get camera functionality working in HomeKit (personally I find it more trouble than it's worth) simply having switch capability is useful! In particular it allows you to automate cameras switching on and off depending on things like when you leave and return to the house. There are ways of doing this within the Wyze app, but IMHO HomeKit gives you substantially more control.
Hi, pals, i'm new to Homebridge (less than 48 hours in) i just fixed the Wyze plug in and all my devices just showed up for the first time, dumb question but, is this plug in only for switches or is it to see the feeds of cameras? because all my cameras just appear as switches. thanks
The best way to get your Wyze cams into Homekit is using Scrypted. The dev even has a plugin for Wyze so you do not need to use something like wyze's old RTSP firmware or Docker-Wyze-Bridge.
https://github.com/jfarmer08/wyze-api/releases/tag/v0.1.1.3 should resolve this.
Describe The Bug:
I received an email to change my Wyze password and noticed afterwards that Homebridge could no longer connect to Wyze. I updated the password, generated a new API key, uninstalled plugin, tried different version, nothing worked.
To Reproduce:
Expected behavior:
Logs:
Plugin Config:
Screenshots:
Environment: