Hi, i try to start a development of a new plugin. i followed along with the plugin tutorial except i didnt use the taskbar. but i cant get the data to show up in my config screen.
what am i doing wrong?
init.py
# coding=utf-8
from __future__ import absolute_import
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2019 chriswal - Released under terms of the AGPLv3 License"
from octoprint.settings import settings
import octoprint.plugin
from octoprint.server import user_permission
class MMU2Plugin(octoprint.plugin.StartupPlugin,
octoprint.plugin.SettingsPlugin,
octoprint.plugin.AssetPlugin,
octoprint.plugin.TemplatePlugin):
def on_after_startup(self):
self._logger.info("mmu2 plugin started")
# _serialport=self._settings.get(["serialport"])
# self._settings.set(["serialport"], _serialport)
self.serialport=self._settings.get(["serialport"])
##~~ SettingsPlugin mixin
def get_settings_defaults(self):
return dict(serialport="Auto",baudrate="115200",timeout=30)
# okresponse="ok",
# checkpresent="S0",
# stopfeeding="A",
# mmu2commands=dict(
# filamentchange="T",
# loadfilament="L",
# mmu2mode="M",
# mmu2reset="X0",
# findastate="P0",
# filamenttype="F",
# mmu2firmwareversion="S1",
# mmu2buildnummer="S2",
# mmu2driveerror="S3",
# continueloading="C0",
# eject="E",
# recoveraftereject="R0",
# waitforuserclick="W0",
# cutfilament="K"
# )
# )
##~~ AssetPlugin mixin
def get_assets(self):
# Define your plugin's asset files to automatically include in the
# core UI here.
return dict(
js=["js/mmu2.js"],
css=["css/mmu2.css"],
less=["less/mmu2.less"]
)
def get_template_configs(self):
return [
# dict(type="navbar", custom_bindings=False),
dict(type="settings", custom_bindings=False)
]
##~~ Softwareupdate hook
def get_update_information(self):
# Define the configuration for your plugin to use with the Software Update
# Plugin here. See https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update
# for details.
return dict(
mmu2=dict(
displayName="MMU2 Plugin",
displayVersion=self._plugin_version,
# version check: github repository
type="github_release",
user="chriswal",
repo="OctoPrint-MMU2",
current=self._plugin_version,
# update method: pip
pip="https://github.com/chriswal/OctoPrint-MMU2/archive/{target_version}.zip"
)
)
def __plugin_load__():
global __plugin_implementation__
__plugin_implementation__ = MMU2Plugin()
global __plugin_hooks__
__plugin_hooks__ = {
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
}
mmu2_settings.jinja2
<h3>{{ _('Octoprint MMU2 Settings') }}</h3>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label">{{ _('Enable support')}}</label>
<div class="controls">
<input type="checkbox" name="pluginActionCommandPromptEnableGroup" data-bind="checked: settings.plugins.mmu2.enable">
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Port') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.plugins.mmu2.serialport">
</div>
<label class="control-label">{{ _('Baudrate') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.plugins.mmu2.baudrate">
</div>
<label class="control-label">{{ _('Timeout') }}</label>
<div class="controls">
<input type="number" step="0.1" data-bind="value: settings.plugins.mmu2.timeout">
</div>
</div>
<div class="advanced_options">
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.advanced_options', container: '.hide' }"><i class="fa fa-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
<div class="hide">
</div>
</div>
</form>