Octoprint randomly disconnects and doesn't reconnect for a random amount of time (most of the times a few hours) or until I unplug and replug the Pi (Pi4b). If a print is running while it is disconnected it continues without problems. It seems to tend to disconnect when I start a print but it also happens in other occasions.
What did you already try to solve it?
searched the forms and generally upgraded the setup (better power supply, heatsink)
Have you tried running in safe mode?
yes
Did running in safe mode solve the problem?
no
Systeminfo Bundle
You can download this in OctoPrint's System Information dialog... no bundle, no support, unless the reason you couldn't retrieve the bundle is your network issues
Hardware you are trying to connect to, hardware you are trying to connect from, router, access point, used operating systems, ... as much data as possible
Pi 4B connected to a Fritz mesh repeater (which works fine for any other device)
Is your Pi inside a metal case? Those can shield the WiFi antenna on the Pi. You can try to change the orientation of the Pi until you get a better WiFi connection.
To narrow down the cause of the problem and it is possible for you, you can try to connect the Pi temporarily via ethernet. If the problem goes away with ethernet, the cause has something to do with the quality of your WiFi.
That's a good point, the heatsink I've installed is made of aluminium and I think its gotten worse since I've installed it. On the other hand I can see that the pi is getting around 55% signal strength with a plugin right now. Is there a way of upgrading the antenna (for example an USB WiFi Antenna)?
You can look for a USB WiFi plug that is compatible with Linux/RaspiOS.
I have no experience with those on a Raspberry Pi, as all my (Octo)Pis are located in the vicinity of an ethernet switch. I do have one of those WiFi USB plugs on my main PC for fallback internet access via mobile hotspot, but I had to search a driver for it and compile it myself.
Perhaps somebody else here on the forum can chime in with names of models that work out of the box.