xblax / flashforge_ad5m_klipper_mod

Unoffical mod for Flashforge Adventurer 5M (Pro) 3D printers to run Moonraker, custom Klipper, Mainsail & Fluidd
GNU General Public License v3.0
82 stars 4 forks source link

OctoEverywhere Support #63

Open skylatian opened 2 months ago

skylatian commented 2 months ago

One of the reasons I had for running klipper on the AD5m Pro was to use Octoeverywhere for remote connections! I had a feeling it wouldn't work, but gave it a shot anyways. I had to run the script with sh install.sh and this was the output. Interestingly, it ran in K1/K1 max mode. image

What kind of work would it take to get this running? I'm going to poke around with this but I have a feeling that it's very similar to the "K1 mode" of the official installer.

consp commented 2 months ago

You'd have to build a venv environment for it. I guess it's doable depending on what is exactly required. Never used it but the description tells me it's going to eat resources.

From the installer:

if grep -Fqs "ID=buildroot" /etc/os-release
then
    IS_K1_OS=1

a K1 build would be triggered yes.

I caution you that there is no compiler (and buildroot doesn't supply one) on the device so any cpython modules will fail to build if you try to install it on the device. You'd have to cross compile them and install them that way. Creating the venv's is quite an intesive process at the moment unfortunately.

xblax commented 2 months ago

That script tries to call pyhton3.8 for some reason which we don't have. Not sure where it gets that idea from. Probably the K1 installer will also not work out of the box.

Technically it could probably run on the printer but it would need a manual install/build process at the moment. As any easy solution you can also connect an external PI and run it there.

mallison01 commented 2 months ago

I may try this, I really want obico since they offer a self hosted server which I run.

They do offer a container for obico but it fails to run and I have not had time to try further.

I may look into octoeverywhere on a VM or container if someone has one.

I will look into running this externally if possible and report back if I figure it out.

I'm fine with offloading stuff to an external device.

qfertig commented 2 months ago

I may try this, I really want obico since they offer a self hosted server which I run.

They do offer a container for obico but it fails to run and I have not had time to try further.

I may look into octoeverywhere on a VM or container if someone has one.

I will look into running this externally if possible and report back if I figure it out.

I'm fine with offloading stuff to an external device.

Yo! have you tried this? I have an extra PI and an old laptop both sitting around that could probably run the companion app, for octoprint, or obico. Assuming it will interact just fine, I will probably try when I get off work, but just figured I would shoot and see if you have tried it yet before I bothered.

qfertig commented 2 months ago

I really wanted to get octoeverywhere to work, but it wouldn't install the .sh no matter the syntax I tried, today I realized that the amount of RAM on the ad5m may not be enough to sufficient enough run octoeverywhere anyways on top of what is installed already. Looking through the history it was a trial as it was to get the mod to work on how limited to resources are as it is, but if it could run it on the board, that would be awesome. I wonder if it was a syntax error on my end? As I stated the install.sh would just fail to do anything no matter the directory or the permissions given to the file.

consp commented 2 months ago

Looking at the requirements further (and the install file), you'd have to install it manually and create a venv with precompiled wheels. The install.sh script not going work due to it assuming it's on a debian based system or the K1. Neither is going to be compatible.

Looking at the requirements: websocket_client -> should work requests -> should work octoflatbuffers -> might work pillow -> needs to be a wheel but is possible, cannot be installed on the device so you need to compile the wheels beforehand certifi -> should work rsa -> should work, but why... will be slow anyways (and also, NEVER claim "secure" when using this library anywhere and it's only used for security theatre anyways since the threat vector is a man-on-the-device with root access, when that happens everything done doesn't matter anymore and is pointless) dnspython -> should work httpx -> should work, optional-dependencies might not work due to required external libraries urllib3 -> should work, same issues as httpx sentry-sdk -> ... (remove if possible) configparser -> should work paho-mqtt -> not required and won't work due to missing dependencies.

Haven't looked further at what it does exactly but if it's just a simple tls tunnel it should be doable if someone wants to put the time into it to create the venv. If it starts modifying data it might eat up a lot of memory.

If it starts re-encoding streams or making screenshots it's unlikely to work due to memory constraints.

johncotten commented 2 months ago

AI Detection, Pause, Cancel remotely all appear to work! OctoEverywhere using a virtual Octoprint with the OctoEverywhere companion install. Need to install a local Moonraker install and change the conf file to point to Moonraker on the 5m...

https://blog.octoeverywhere.com/octoeverywhere-companion-remote-access-for-any-klipper-printer/

Screenshot 2024-03-18 at 7 23 29 PM

skylatian commented 2 months ago

It worked for me as well, but without config changes!

I also finally got time to give Octoeverywhere Companion a shot, and it works great — I didn't need to run a local Moonraker instance or change any config files (detail below). I'm totally fine running this externally, though down the line it would be great to have OctoEverywhere running on the AD5M.

I'm running this on an Ubuntu VM on a Synology NAS, but the process should be basically the same on any Ubuntu or Debian machine. This is basically the same as the steps here, just documenting them here for reference.

Adventurer 5M (Pro) OctoEverywhere Companion Install

On the companion device:

sudo apt update sudo apt install curl (may be required, it was for my barebones Ubuntu image) bash <(curl -s https://octoeverywhere.com/companion.sh)

While following the setup prompts that appeared, Companion failed to find a Moonraker instance at the port I provided. However, the installer then prompted for the full IP+UI port of the machine. I chose Fluidd, and it detected the Moonraker install and worked right away!

image
johncotten commented 2 months ago

Yeah I forgot to mention this requires no changes on the 5M itself. I couldn't get past the Moonraker part so just installed it on the Octoprint. Thanks for the info on running straight off ubuntu and on the synology.

skylatian commented 2 months ago

Ah, gotcha! Re-reading I can see that you meant the config of the local Moonraker install. Pointing it to Fluidd worked for me, but only after the initial Moonraker port connection failed.

Could you clarify what you mean by "just installed it on the Octoprint?" Do you mean that you installed it on the device you're running Octoeverwhere Companion on?

johncotten commented 2 months ago

Yes, I first installed VMware Fusion and then created a virtual machine with Kali linux, then installed Octoprint. Your solution is so much simpler, just a simple linux install and then the companion. I didn't even think about running the VM on my Synology. Was almost considering a Raspberry Pi Zero 2 W, figured it would probably tuck in the back.

consp commented 1 month ago

I think the guide from @skylatian is probably best for now, I've copied it to the docs in docs/OCTO_EVERYWHERE.md with a reference to this thread and the OP. See e11fbc0

AJolly commented 1 week ago

Anyone have any luck getting the obico plugin to connect? (obviously, youd need to use the cloud instance or run your own obico server elsewhere)

mallison01 commented 1 week ago

I have it running on another raspberry pi and tweaked the obico cfg to point to the AD5M. I have a self hosted obico server.

The only issue is sometimes I have to reboot the pi after I turn on the AD5M for everything to connect promptly. Otherwise it works.

I am out of town right now but I can share the setup later when I'm back.

But I think it's setup like someone else did with octoeverywhere

AJolly commented 1 week ago

Yeah I'd be interested if you have a guide. I couldn't quite get it to work, first there wasn't bash then no apt-get admittedly didn't try further.