OctoPrint for the Seeed Studio reTerminal – Live Blog – Day 7

This post is a series of posts in which I detail my journey to bring OctoPrint to the Seeed Studio reTerminal.

Day 7

In today’s post we’ll be continuing the addition of a Settings Page so we can set the URL first with the config.yaml file and also then with a new Template.


Continuing the Settings Page – 12-09-22

We need to replace our init.py file again with the following;

import octoprint.plugin

class HelloWorldPlugin(octoprint.plugin.StartupPlugin,
    def on_after_startup(self):
        self._logger.info("Hello World! (more: %s)" % self._settings.get(["url"]))

    def get_settings_defaults(self):
        return dict(url="https://en.wikipedia.org/wiki/Hello_world")

    def get_template_vars(self):
        return dict(url=self._settings.get(["url"]))

__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=3.7,<4"
__plugin_implementation__ = HelloWorldPlugin()

Where we’ve now added a line to get the template variables with get_template_vars.

And also replace our templates/helloworld_navbar.jinja2 file with;

<a href="{{ plugin_helloworld_url|escape }}">Hello World!</a>

Where we’re now grabbing the URL from our plugin settings.

Reloading OctoPrint, refreshing the page and hovering over our “Hello World” link we can see that the link is still the same;

Hello World Plugin Link

Using the OctoPrint config.yaml

We can set the value of our URL setting by adding it to the OctoPrint config.yaml file within the plugins section. The docs state that we should add that section if it doesn’t exist… Let’s have a look…

I don’t seem to be able to find the config.yaml file in the OctoPrint folder… Looking on the internet, I see that there should be one at %APPDATA%/OctoPrint so let’s go and have a look there…

Opening up the run dialog with WIN+R;

Windows Run Dialog

Hmmm… No luck there;

OctoPrint Folder Not Found

Searching in the OctoPrint folder in VS Code, I find the documentation for the config.yaml file;

OrtoPrint – Config.yaml Documentation

This file says;

If the file is not there, you can just create it – it will only get created by OctoPrint once you save settings that deviate from the default settings

So, I wonder if just changing the settings in OctoPrint through the UI will create the file for us?

Navigating to the Settings page, I’ve had a quick look at the Folders page;

OctoPrint Settings – Folders

Knowing that the OctoPrint folder isn’t event there, I wonder if just pressing the Test button beside any of the folders would create either the folder or even the config.yaml file?

OctoPrint – Settings – Path Valid

So the path is valid… Now, has it created the folder and/or the config.yaml file?

OctoPrint folder doesn’t exist

Sadly not then it seems… Well, let’s try changing one of the OctoPrint settings then eh.

Let’s try something simple like selecting the Remember selected folder in file list;

OctoPrint – Settings – Features

Sadly that didn’t work;

No OctoPrint Folder again

I wonder if it’s created anything in the OctoPrint Project Folder?

Sadly, I find nothing there…

Ok, so, the documentation I found says that we can just create the file… So, let’s do that and see if it will use it.

Navigating to my %APPDATA% folder, I can create an OctoPrint folder, and then a config.yaml file;

OctoPrint – Created config.yaml file

Looking back at the Hello World plugin tutorial, we need to add the following to the config.yaml file;

    url: https://de.wikipedia.org/wiki/Hallo-Welt-Programm

Adding that to the file, saving it and restarting the OctoPrint Server, let’s see if the URL has changed;

OctoPrint – Hello World Plugin – URL Not Changed

Sadly the URL hasn’t changed.

Checking in the settings, our setting we changed earlier has saved ok;

OctoPrint – Settings – Features – Setting saved

So something is being saved somewhere, but I don’t know where…

Searching in the project codebase for config.yaml I find it appears in quite a few files;


Looking in settings.py I can see where the code is defaulting to the base directory of and appending config.yaml.

Stopping the Server, adding a break point and restarting the server, we can see where the application is expecting to load the config.yaml file from;


Hovering over self._configfile we can see that indeed, OctoPrint is looking for the config.yaml at 'C:\Users\pete_\AppData\Roaming\OctoPrint\config.yaml', which is where we’ve created it.

Time to dig a bit deeper… I’m guessing that perhaps our issue is that we don’t have a correctly formatted file perhaps…

Let’s go look what an example config.yaml file looks like.

After having to restart my existing OctoPi Pi, and do some network diagnosis when I couldn’t reach it, I can SSH into the OctoPi using the Terminal;

OctoPi – SSH

Navigating to the ~/.octoprint directory and opening the config.yaml file in nano with nano config.yaml;


Looking at the docs for the config.yaml file, this looks like what I’ve pasted is ok to be fair.

Leave a Reply