Trick #27: How does Printoid connect to your OctoPrint server?

To ensure Printoid is able to communicate with your OctoPrint server, the application is performing some important actions with your server when you open it.

First, please read this tutorial to understand the settings to provide to Printoid in order to connect to your OctoPrint server.

1. Why the connection step is mandatory?

Reasons are simple to understand.

  • May your server is not reachable when you open the app. No one command of the app would work in this case. Very bad for the user-experience.
  • The configuration you’ve given to Printoid may contain mistakes (wrong IP, wrong API key, basic authentication missing…)
  • You have provided both LAN and WAN address. Printoid smartly handles the correct one according your current network connection.

 

2. How Printoid ensures that your server is reachable and ready?

Depending on the settings you’ve provided to Printoid, there are 3 differents cases to handle the connection with OctoPrint.

First case: you’ve provided only LAN settings

Step 1: ping the server
Printoid tries to ping your server and check if the ICMP packets are properly received.
If it fails, that means that you server is not reachable (probably not powered ON? not started?) or that you are simply not connected to the same local network with your phone/tablet.

Step 2: communication with the server
Printoid tries to communicate with your server by requesting its status, by sending a GET request over the REST API of OctoPrint.
If it fails, the reason is indicated in the alert dialog. May you have provided the wrong IP address? The wrong API key? You server is not powered ON? Not started?
Have you provided the correct basic authentication if needed? Is your server using SSL?
Or the server can also be in an unknown state, or currently busy. The HTTP error code is helpful to understand what’s going wrong, in most of cases.

Step 3: communication with the printer
Printoid will try to send a M105 command to your 3D printer over the REST API of OctoPrint. (M105 does not perform any action on your 3D printer, it only requests the current temperatures values). In fact, it does not matter if your 3D printer is currently not connected, because OctoPrint will reply that the temperatures could not be read yet.
This step should not failed if the Step 2 succeed. But sometimes your server replies that something is going wrong. May you can check if everything is properly configured in your server’s settings? Have you created a printer profile for example?

Second case: you’ve provided only WAN settings

Step 1: ping the server
This step is skipped in this case. A lot of routers don’t not allow the ping of the public address.

Step 2: communication with the server
Printoid tries to communicate with your server by requesting its status, by sending a GET request over the REST API of OctoPrint.
If it fails, the reason is indicated in the alert dialog. May you have provided the wrong IP address? The wrong API key? You server is not powered ON? Not started?
Have you properly followed this tutorial to make your OctoPrint server reachable over the Internet?
Have you provided the correct basic authentication if needed? Is your server using SSL? Or the server can also be in an unknown state, or currently busy. The HTTP error code is helpful to understand what’s going wrong, in most of cases.

Step 3: communication with the printer
Printoid will try to send a M105 command to your 3D printer over the REST API of OctoPrint. (M105 does not perform any action on your 3D printer, it only requests the current temperatures values). In fact, it does not matter if your 3D printer is currently not connected, because OctoPrint will reply that the temperatures could not be read yet.
This step should not failed if the Step 2 succeed. But sometimes your server replies that something is going wrong. May you can check if everything is properly configured in your server’s settings? Have you created a printer profile for example?

Third case: you’ve provided both LAN and WAN settings

That’s where Printoid is smart: it will automatically handle the connection according to your current network connectivity type. The steps executed are the same as the first case when Printoid is testing the LAN IP. The steps executed are the same as the second case when Printoid is testing the WAN IP.

Conditions 1: Very first connection to OctoPrint – connected to a WiFi network
Printoid will test the LAN IP first. If it fails, then it will test the WAN IP.

Conditions 2: Very first connection to OctoPrint – connected to the cellular network (3G/4G)
Printoid will test the WAN IP first. If it fails, then it will test the LAN IP (even if it’s pretty useless).

Conditions 3: Not the first connection – connected to a WiFi network – Printoid recognizes the SSID as your local network
Printoid will test the LAN IP first. If it fails, then it will test the WAN IP.

Conditions 4: Not the first connection – connected to a WiFi network – Printoid does not recognizes the SSID as your local network
Printoid will test the WAN IP first. If it fails, then it will test the LAN IP

Conditions 5: Not the first connection – connected to the cellular network (3G/4G)
Printoid will test the WAN IP first. If it fails, then it will test the LAN IP (even if it’s pretty useless).

Conditions 6: You have forced Printoid to test the LAN IP first (from the settings) – it does not matter the current connection type
Printoid will test the LAN IP first. If it fails, then it will test the WAN IP.

Conditions 7: You have forced Printoid to test the WAN IP first (from the settings) – it does not matter the current connection type
Printoid will test the WAN IP first. If it fails, then it will test the LAN IP.

Please note that, for all the previous conditions:

  • If both of the two tests are in failure (LAN IP & WAN IP tests) then Printoid will display you the two errors, in order to let you understand what’s going wrong.
  • The IP address currently in test by Printoid is indicated in the progress dialog.
  • You can abort the connection process by clicking on the “X” icon on the top-right corner of this progress dialog.
  • When Printoid is connected to your OctoPrint network with success, the IP address currently in use is indicated in the header of the left menu (below the OctoPrint profile name).

 

3. My connection fails, should I send the logs to the developer?

In the alert dialog when the connection fails, Printoid let you the possibility to send the connection logs to the developer. Before using this feature, please ensure that:

  • Your OctoPrint server is powered ON
  • Your OctoPrint server is reachable using Google Chome from your device (smartphone or tablet)
  • You have double-checked the informations you have provided to Printoid
  • You have provided the LAN IP in the LAN field, and the WAN IP in the WAN field in your OctoPrint profile configuration
  • In distant access (WAN), you have properly configured your router following this tutorial
  • You have provided the correct basic authentication credentials if needed (these credentials are defined in haproxy – that’s not the login/password of your OctoPrint web interface)
  • If your server is using SSL, you have activated the associated option in your profile
  • If your server is NOT using SSL, you have NOT activated the option in your profile

Everything is already explained on this tutorial.

  • Please, do not abuse this feature. I will receive an email each time you are clicking on “send logs to the developer”.
  • Please, add a message to the logs. I’m not a machine, I need to understand the context when you encounter connection issues.
  • Please, try to connect to OctoPrint using Google Chrome or any other web browser on your device first. Printoid CAN’T connect to OctoPrint if OctoPrint is NOT reachable from your device.

 

4. What does Printoid do not do?

Printoid is only attempting to connect to an OctoPrint server, when this last is properly reachable from your device (smartphone or tablet).

  • Printoid does not do the network configuration for you
  • Printoid does not make your OctoPrint reachable over the Internet for you
  • Printoid does not fix the connection issues for you
  • Printoid does not configure OctoPrint for you
  • Printoid does not configure haproxy for you
  • Printoid does not do any magical tricks for you!
  • Last but not least, Printoid does not make coffee 😉

I can help you to fix your connection issues by email, but please note that I’m not the developer of OctoPrint, nor a network engineer 😉

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s