ziirish / OctoPrint-TuyaSmartplug

Tuya Smartplug plugin for OctoPrint
Other
19 stars 15 forks source link

Cannot toggle plug with new install of Octoprint under Python 3.10 #42

Open shaddow501 opened 2 years ago

shaddow501 commented 2 years ago

Hello, this is the error I get, where do I go from there?

octoprinttuyasmartplug.utils.pytuya - ERROR - Unexpected status() payload=b'\xcd\x1cI\x1d*A6O\xc8\xbb\x19\xbc\xc2A\xbbCK\x85QHg\x8d\x84u,,X\xbe\xd3E\xb6' octoprinttuyasmartplug.utils.pytuya - ERROR - Unexpected status() payload=b'\xcd\x1cI\x1d*A6O\xc8\xbb\x19\xbc\xc2A\xbbCK\x85QHg\x8d\x84u,,X\xbe\xd3E\xb6' octoprint.server.api - ERROR - Error while executing SimpleApiPlugin tuyasmartplug Traceback (most recent call last): File "/home/printer/OctoPrint/venv/lib/python3.10/site-packages/octoprint/server/api/init.py", line 154, in pluginCommand response = api_plugin.on_api_command(command, data) File "/home/printer/OctoPrint/venv/lib/python3.10/site-packages/octoprint/util/init.py", line 1688, in wrapper return f(*args, kwargs) File "/home/printer/OctoPrint/venv/lib/python3.10/site-packages/octoprint_tuyasmartplug/init.py", line 258, in on_api_command self.check_status("{label}".format(data)) File "/home/printer/OctoPrint/venv/lib/python3.10/site-packages/octoprint_tuyasmartplug/init.py", line 229, in check_status "on" if self.is_turned_on(response, pluglabel) else "off" File "/home/printer/OctoPrint/venv/lib/python3.10/site-packages/octoprint_tuyasmartplug/init.py", line 242, in is_turned_on return data and plug and data.get("dps", {}).get(str(plug["slot"])) AttributeError: 'bytes' object has no attribute 'get'

swilsonnc commented 1 year ago

Are you running Ubuntu 22.04 by chance? I had the same issue and ended up going back to ubuntu 20.04 and it works great still. Something to do with python compatibility problems with 22.04.