Plugin settings not being created / saved

What is the problem?
When trying to set settings for my plugin they somehow aren't properly saved & don't appear in the settings (localhost/api/settings). Upon checking for the settings-values I just set, it returns None

What did you already try to solve it?
I've tried replicating the code from a working plugin I use "DeleteAfterPrint" - upon installing, the settings are created as they should.

The code in my plugin;

# coding=utf-8
from __future__ import absolute_import
import octoprint.plugin
import octoprint.settings
import os

class PrinterHubTestPlugin(octoprint.plugin.SettingsPlugin,

    # #~~ StartupPlugin mixin
    def on_after_startup(self):
        self._settings.set_boolean(["test1"], True)
        self._settings.set_boolean(["test2"], False)
        self._settings.set(["test3"], "test_string")


Additional information about your setup

  • Octoprint version: 1.3.12 running on OctoPi 0.15.1

You first need to declare a list of default settings. Basically tell OctoPrint what kind of settings you even support. Take a look at the docs of the SettingPluginMixin for how to do that.

1 Like

Ah - makes sense. I did see the get_settings_defaults function, although I thought it was just a helper-function in the plugin I was looking at, and not something that was required.

Thank you!