Yea, Frustrating …
But i know what was happening and how to avoid it in future.
To explain issues first I will describe how Mainsail-Moonraker-Klipper is properly working.
- When you enter some
Address
in Browser (like Delta or Delta.local) browser will try to resolve it to IP address, when it’s successful resolved by some subsystems (there are many different sub-systems involved in this resolvent) then browser will go to that IP and try to fetch a default Web page from that IP.
- When
Mainsail
is installed on machine then it’s considered as that Default Web page.
- So when Browser load default (Mainsail) web page it will kick additional actions to load additional resources for Mainsail UI, one of those resources will be that
config.json
file.
- When Mainsail UI will load that config.json file - it will analyze it and will take decision what to do.
By default that file have property hostname set to null
- this will tell Mainsail UI to search moonraker instance in same address which you did enter in browser, also by default it contain property port
set to null
- this will tell mainsail UI to use standard Moonraker port 7125.
- Now when Mainsail know where to search moonraker it will connect there and starts communicating with moonraker with it’s language, query printer data, send commands, etc…
- Moonraker will convert them to klipper language and will interact with klipper thru defined connection (klippy.sock file).
This describes what should be happening in normal properly working system.
Now what was happening in your case:
When you did install and configure some machine you did define it’s name, for example it was “Delta”.
While you was installing all require software and configuration that name “Delta” name did propagate thru your network to your PC and did bring it’s current IP address with it.
You did finish setup and configuration and everything is working properly - Great.
Now when that “Delta” system did experienced reboot or power failure it was booted again but this time it did receive other IP address from your router DHCP system.
When you did try to open it again in browser there could be 2 outcomes,
First possible outcome - when your browser try to resolve that “Delta” to IP address it can resolve it to old IP address because it didn’t propagate to your PC, in this scenario your browser will not load Mainsail UI at all and you will get general connection timeout error.
Second possible outcome is that your browser will resolve that “Delta” name to new IP address and start loading Mainsail UI from new IP address, but when it try to reach moonraker - it can’t because connecting there is done thru other sub-system called websockets
which are using other methods to resolve that “Delta” name and it’s resolving it to old IP address.
Those short names (like “Delta”) are very unreliable by themselves and very often propagation of that name can stuck in some sub-systems but when you additionally have Dynamic addresses, propagation of new IP address is even worse. There is a possibility to make them reliable - but it require special complex services for that and additional proper complicated configuration of network in each device.
When you bind IP address to specific device - this will help eventually when that name will propagate everywhere with latest IP and you will not experience additional issues with IP changes.
I usually suggest to avoid this kind of issues all together by using only IP addresses, don’t use those short names, they are very unreliable.
When you are using IP addresses - then browser and all sub-system don’t doo that resolvent at all, they bypass that naming systems and immediately go to that IP address.
You can say - I did try to use direct IP address in browser to open Mainsail, but it still didn’t see moonraker !
I have explanation for this case also:
It was happening because you have mismatched port settings in mainsail config.json
and moonraker.conf
, i did see that in files and screenshots which you did post.
when mainsail config.json
file have port attribute set to null
- this will tell Mainsail UI that moonraker should be on it’s default network port 7125, but some of your moonraker.conf files specify other port number, so in this kind of scenario moonraker is waiting on some customized port like 7126 but Mainsail is trying to connect on default port 7125 - and it can’t see moonraker there.
To check/fix this issues you should analyze each system independently.
Check which port
is defined in moonraker.conf
and check which port
is defined in Mainsail config.json
if moonraker.conf
file specify default port
as 7125
, then you can have port
value null
in config.json
, if moonraker.conf
have some other value - you need to put same value in config.json
Sorry for long post, I’m just trying to explain everything what is happening for you or somebody else who will be reading this in future.