Closed Amannim closed 2 years ago
Seems like you got through the first issue by inputting your Wyze credentials. I could probably handle that more gracefully to avoid the AttributeError
but I don't believe that has anything to do with the problem you're facing now.
Could you describe the current state of things a bit better? Did OctoPrint disable the plugin? Is the plugin's tab empty or is there info there?
As for your last question, it shows me the devices that are shared with me. I'm obviously not able to do exhaustive testing because I don't have unlimited Wyze accounts and devices but I would imagine you'd find the same to be true.
The plugins tab for the wyze plugin on the dashboard screen has the div with all the column headers for management, but there is nothing appearing in the list to actually manage.
Though now I'm wondering if maybe it's a style issue and the grid is just cut off. I'll check the html source tomorrow to be sure.
Is the devices list coming back from wyze cached anywhere? Or some other way I could test the plugin. Suppose now is a good a time as any to finally learn Python lol.
Interesting. I'm curious whether refreshing the page has any effect?
If not, try this (make sure you're running in the same Python virtual environment that OctoPrint is installed under!!!):
from octoprint_wyze import Wyze
wyze = Wyze(email="EMAIL", password="PASSWORD")
for device in wyze.client.devices_list():
print(device.nickname)
Replace EMAIL and PASSWORD with your Wyze credentials. Make sure to leave the quotes!
Traceback (most recent call last):
File "/home/pi/oprint/bin/wyze_test.py", line 2, in
Amazing! I know what the problem is :)
Currently I only support "Light", "Plug" and "Camera" as device types because those are the only devices that I personally own. Since you have a "MeshLight" it breaks my code because I have not told it what to do if an unsupported type gets passed in.
I'll fix this up tonight (and add MeshLight as a supported device because why not) and release a new version. Check back in a little while!
Should be fixed with the new release!
Please confirm (since I cannot as I don't own the devices I'd need to test) and close the issue if it's fixed for you. If something else is also wrong, feel free to leave this issue open and we'll fix that too.
Interesting so this account only has shared with it a Cam v2 and an Outdoor camera. Not sure where the MeshLight came from. I'll test the update soon as possible.
So the test code you provided returns a list now, progress! This list also includes a device I do not recognize, looks like a Wyze Bulb. Have to figure out how that became attached to the account.
However the OctoPrint-Wyze plugin tab has an empty table. I see the "foreach devices" in the HTML table header, and none of the devices are populating rows.
Ok solved the mystery of the Wyze Bulb, that is legit. The name of the device has a space in it, I haven't looked at your code yet, but I wonder if the space is breaking any sort of JavaScript or HTML DOM logic?
That's odd. Again, I'd urge you to try refreshing the page if the table is empty (this sometimes happens to me as well for some reason but I've found that refreshing the page with the plugin tab open works reliably).
If that doesn't work, try this.
static/webassets/packed_plugins.js
(this might have some random characters suffixing it - ignore those).OctoPrint.simpleApiCommand
is called with the get_devices
parameter.self.devices(devices)
, then refresh the page and report back on what shows up in the "Scope." As you can see, for me the devices
array contains three items.This will help us determine whether the information is getting sent properly to your browser and hopefully help us narrow down where it's failing.
Hi! Sorry, life got in the way of my working on this for a bit. I had to completely uninstall and remove the data, then reinstall the plugin fresh and viola! it works! At least so far as it shows me logged in and the devices are appearing as expected. Still have to play with the settings, but we can close this particular issue.
Thanks again!
Hi! Running the 1.0RC of OctoPi with OctoPrint 1.7.3 and Python 3.9.2. First attempt at installing the plugin seemed to have failed, was getting errors on missing values in settings.py. Uninstall, reinstall, now seeing an error:
2022-03-26 20:26:04,300 - octoprint.server.api - ERROR - Error while executing SimpleApiPlugin wyze Traceback (most recent call last): File "/home/pi/oprint/lib/python3.9/site-packages/octoprint/server/api/init.py", line 158, in pluginCommand response = api_plugin.on_api_command(command, data) File "/home/pi/oprint/lib/python3.9/site-packages/octoprint/util/init.py", line 1737, in wrapper return f(*args, **kwargs) File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_wyze/init.py", line 117, in on_api_command devices = self.wyze.get_devices(self.event_handler) AttributeError: 'WyzePlugin' object has no attribute 'wyze'
Saw that twice, could have been during a restart before I had the user/pass entered.
Have the details in now, reboot and see:
2022-03-26 21:22:23,391 - octoprint.plugins.wyze - INFO - Sending enums... 2022-03-26 21:22:23,411 - octoprint.plugins.wyze - INFO - Sending device info...
No errors. I enabled DEBUG logging for wyze, and the octoprint.server.api, no new details.
Anything else I can do to troubleshoot?
Also curious, will this work if a device is shared with me, or do I have to be the primary "owner" of it?
Thanks!