OctoPrint-FanSpeedSlider/octoprint_fanspeedslider/__init__.py

45 lines
1.1 KiB
Python

# coding=utf-8
from __future__ import absolute_import
import octoprint.plugin
class FanSliderPlugin(octoprint.plugin.StartupPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.SettingsPlugin,
octoprint.plugin.AssetPlugin):
def get_settings_defaults(self):
return dict(fanSpeed=100)
def get_assets(self):
return dict(
js=["js/fanslider.js"],
css=["css/style.css"]
)
def get_template_configs(self):
return [
dict(type="settings", custom_bindings=False)
]
def get_update_information(self):
return dict(
fanspeedslider=dict(
displayName="Fan Speed Slider",
displayVersion=self._plugin_version,
# version check: github repository
type="github_release",
user="ntoff",
repo="OctoPrint-FanSpeedSlider",
current=self._plugin_version,
# update method: pip
pip="https://github.com/ntoff/OctoPrint-FanSpeedSlider/archive/{target_version}.zip"
)
)
__plugin_name__ = "Fan Speed Slider"
__plugin_implementation__ = FanSliderPlugin()
__plugin_hooks__ = {
"octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
}