Plugin creation for DUMMY's

Hello every one

i have been trying to create a plugin to simple display on the navbar a lable with some custom text.

i have try'ed to use the wiki template but i get an error in octoprint saying that is is incompatible and i have python incapability (the icon is a small lightning bolt)

i got a clean sample code theat allow me using the template html to write "hello world" as a h1 tag but it shows in the bottom of the page.

another nood thing... i asked chat gpt,, bard etc... for help and all the python 3 code they generate it giver error in octoprint.

i have instaled cookiecutter and played with the example it creates and it works but whenever i try to add any code to the generated file, octoprint does not recognise it...

so.. does anyone know of a video or tutorial on "how to create a plugin for octoprint for DUMMYS" ??

thank you all

The hello world plugin tutorial kind of covers it. If you were to put your code up on GitHub or make available to review it might help us assist you in where things may not be linked up right. The python compatibility bit you mention is probably just missing a line like this.

hello mate

thank you for the reply...

i am still in the verry beggining and trying to get my head arround it
i used this page to start

working hello_world

here my git with the sample code
i am trying to activate an extrator pump/motor via the gpio ( i know about the octorelay) but i need other things... but the 1st thing is getting the button to work with octoprint

Pump test - NOT working


thank you

it is there
plugin_pythoncompat = ">=3,<4" # Only Python 3

just uploaded the full folder to github

just changed the line

from --- __plugin_pythoncompat = ">=3,<4" # Only Python 3

to ---- plugin_pythoncompat = ">=3.7,<4"

and it "works" but no button


The issue you're running into about the navbar not loading is your adding the template as generic here. Change that to "navbar" and it should load the button in the top.

and in the jinja2 file should this work ?

<button id="pump-button">Pump: Activated</button>

That should render on the page, but doesn't have anything tied to it for performing an action.

i know... it was just a test ,,, and sure unufe .... does not render

also i have created a new project where i was able to create a "config" page and when i add some text... anything to the sketeton.settings.jinga2 file the page will not render and it will put the plugin in incompatible mode.

to call the settings page i am using:

    def get_template_configs(self):
        return [
            dict(type="settings", custom_bindings=False),
            dict(type="myplugin_settings", custom_bindings=True)

the jinga2 code

<h4>My Plugin Settings</h4>

  <div class="control-group">
    <label class="control-label">My Option</label>
    <div class="controls">
      <input type="text" name="my_option" value="{{ plugin_settings_default_values['my_option'] }}">
  <div class="control-group">
    <div class="controls">
      <label class="checkbox">
        <input type="checkbox" name="another_option" value="true" {% if plugin_settings_default_values['another_option'] %}checked{% endif %}> Another option

  <button type="submit" class="btn">Save</button>

NOTE the html code was just to test if anything would render.... only for that

ok, now you're mixing new issues with old issues and the above should be like this for loading a settings section.

    def get_template_configs(self):
        return [
            dict(type="settings", template="myplugin_settings.jinja2", custom_bindings=True)

although if your plugin_identifier is myplugin, and the file is named myplugin_settings.jinja2 it will autoload in the UI without the get_template_configs call.

but looking at your code, you're using jinja templating to try to change values, and that is really where the knockout binding stuff comes into play. Let me see if I can possibly provide you with a simple example of a plugin that has both settings and a navbar and you can see if you can make sense of it.

Take note that my get_template_configs call does not include the template file name like above. That's because they are named matching after the pattern <plugin_identifier>_<plugin_type>.jinja2.

The part that glues the backend to the frontend is the js file, and it's critical that your binding elements are configured correctly.

1 Like


i'll go and take a look

ty again