timgir / OctoPrint-MerossMSS425F

A simple Octoprint plugin for shutdown device like printer with Meross MSS425F smart plug
GNU Affero General Public License v3.0
1 stars 3 forks source link

asyncio.run() cannot be called from a running event loop #1

Closed olivierjan closed 3 years ago

olivierjan commented 3 years ago

Hi, I’m trying to get the OctoPrint plugin to work but I keep getting the following error when I try to turn off or on the Meross plug. Do you have an idea what can be causing this issue?

2021-08-12 15:02:50,324 - octoprint.util.comm - ERROR - Error while processing hook meross_mss425f for phase queuing and command M81: Traceback (most recent call last): File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4519, in _process_command_phase tags=tags, File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/init.py", line 1941, in wrapper return f(*args, **kwargs) File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_meross_mss425f/init.py", line 101, in hook_gcode_queuning asyncio.run(shutdown(email, password, id_plug)) File "/usr/lib/python3.7/asyncio/runners.py", line 34, in run "asyncio.run() cannot be called from a running event loop") RuntimeError: asyncio.run() cannot be called from a running event loop

timgir commented 3 years ago

Hello Olivier,

Thanks for use my plugin & for report this issue.

I just test my plugin right now & I cannot reproduce your issue.

But according this thread in SO (https://stackoverflow.com/questions/55409641/asyncio-run-cannot-be-called-from-a-running-event-loop), may be you have a plugin with open a event loop already.

Can you give me your list of active plugin for see is my hypotheses is good ?

olivierjan commented 3 years ago

Hello Timothée, Thanks for your plugin and for taking the time to answer. Here is the list of installed plugins I have installed and active at the moment: Action Command Notification Support Action Command Prompt Support Announcement Plugin Anonymous Usage Tracking Application Keys Plugin Backup & Restore Core Wizard Discovery Error Tracking File Check (2021.2.23) Firmware Check (2021.8.11) GCode Viewer Logging Software Update Virtual Printer

Version of Octoprint is 1.61 running on a Raspberry pi 3B.

In the meantime I'm going to look a bit further into the error too. Olivier

timgir commented 3 years ago

You seem have the defaults plugins shipped with Octoprint so my plugin is the first plugin you install in your Octoprint ?

And what is your version of Python ? In my Octoprint, the lastest version is 3.7.3 version.

olivierjan commented 3 years ago

I actually initially installed many more plug-ins, but in order to do the test I deactivated most of them and left only yours in use . About the version of python I’m using : it’s the same as yours 3.7.3. I’ll be doing a fresh install tonight or tomorrow to troubleshoot a bit more.

timgir commented 3 years ago

I made a modification, can you trying if fix it your issue ?

olivierjan commented 3 years ago

I think I really need to do a fresh install, I removed the old version using plug-in manager, installed the new one using the same method, everything looks fine but after restart the plugin is nowhere to be found. I’ll be troubleshooting my installation over the weekend and will post the results. Cheers,

Olivier

Le 13 août 2021 à 16:12, Timothée Girard @.***> a écrit :

 I made a modification, can you trying if fix it your issue ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

timgir commented 3 years ago

Fix with 6cf3bd9 commit