How to use the octoprint.plugin.SettingsPlugin.on_settings_save function in OctoPrint

To help you get started, we’ve selected a few OctoPrint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jneilliii / OctoPrint-TPLinkSmartplug / octoprint_tplinksmartplug / __init__.py View on Github external
def on_settings_save(self, data):
		old_debug_logging = self._settings.get_boolean(["debug_logging"])
		old_polling_value = self._settings.get_boolean(["pollingEnabled"])
		old_polling_timer = self._settings.get(["pollingInterval"])
		old_powerOffWhenIdle = self._settings.get_boolean(["powerOffWhenIdle"])
		old_idleTimeout = self._settings.get_int(["idleTimeout"])
		old_idleIgnoreCommands = self._settings.get(["idleIgnoreCommands"])
		old_idleTimeoutWaitTemp = self._settings.get_int(["idleTimeoutWaitTemp"])

		octoprint.plugin.SettingsPlugin.on_settings_save(self, data)

		self.abortTimeout = self._settings.get_int(["abortTimeout"])
		self.powerOffWhenIdle = self._settings.get_boolean(["powerOffWhenIdle"])

		self.idleTimeout = self._settings.get_int(["idleTimeout"])
		self.idleIgnoreCommands = self._settings.get(["idleIgnoreCommands"])
		self._idleIgnoreCommandsArray = self.idleIgnoreCommands.split(',')
		self.idleTimeoutWaitTemp = self._settings.get_int(["idleTimeoutWaitTemp"])

		if self.powerOffWhenIdle != old_powerOffWhenIdle:
			self._plugin_manager.send_plugin_message(self._identifier, dict(powerOffWhenIdle=self.powerOffWhenIdle, type="timeout", timeout_value=self._timeout_value))

		if self.powerOffWhenIdle == True:
			self._tplinksmartplug_logger.debug("Settings saved, Automatic Power Off Enabled, starting idle timer...")
			self._reset_idle_timer()
github OllisGit / OctoPrint-PrintJobHistory / octoprint_PrintJobHistory / __init__.py View on Github external
def on_settings_save(self, data):
		# default save function
		octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
github gdombiak / OctoPrint-OctoPod / octoprint_octopod / __init__.py View on Github external
def on_settings_save(self, data):
		old_debug_logging = self._settings.get_boolean(["debug_logging"])

		octoprint.plugin.SettingsPlugin.on_settings_save(self, data)

		new_debug_logging = self._settings.get_boolean(["debug_logging"])
		if old_debug_logging != new_debug_logging:
			if new_debug_logging:
				self._logger.setLevel(logging.DEBUG)
			else:
				self._logger.setLevel(logging.INFO)
github fraschetti / Octoslack / octoprint_Octoslack / __init__.py View on Github external
def on_settings_save(self, data):
        try:
            octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
            self.update_progress_timer()
            self.update_heartbeat_timer()
            self.update_gcode_sent_listeners()
            self._slack_next_progress_snapshot_time = 0
        except Exception as e:
            self._logger.exception(
                "Error executing post-save actions, Error: " + str(e.message)
            )
github ziirish / OctoPrint-TuyaSmartplug / octoprint_tuyasmartplug / __init__.py View on Github external
def on_settings_save(self, data):
		old_debug_logging = self._settings.get_boolean(["debug_logging"])

		octoprint.plugin.SettingsPlugin.on_settings_save(self, data)

		new_debug_logging = self._settings.get_boolean(["debug_logging"])
		if old_debug_logging != new_debug_logging:
			if new_debug_logging:
				self._tuyasmartplug_logger.setLevel(logging.DEBUG)
			else:
				self._tuyasmartplug_logger.setLevel(logging.INFO)
github OllisGit / OctoPrint-DisplayLayerProgress / octoprint_DisplayLayerProgress / __init__.py View on Github external
initDesktopPrinterDisplay = False
        printerDisplayScreenLocationDefinition = data.get(SETTINGS_KEY_PRINTERDISPLAY_SCREENLOCATION)
        if printerDisplayScreenLocationDefinition is not None:
            try:
                json.loads("{"+printerDisplayScreenLocationDefinition+"}")
                initDesktopPrinterDisplay = True
            except:
                # self._plugin_manager.send_plugin_message(self._identifier, dict(notifyType="error", notifyMessage="Printer ScreenLocation could not parsed!"))
                self._sendDataToClient(dict(notifyType="error", notifyMessage="Printer ScreenLocation could not parsed!"))

        printerDisplayWidthDefinition = data.get(SETTINGS_KEY_PRINTERDISPLAY_WIDTH)
        if printerDisplayWidthDefinition is not None:
            initDesktopPrinterDisplay = True

        # default save function
        octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
        self._evaluatePrinterMessagePattern()

        self._layerDurationDeque = deque(maxlen=self._settings.get_int([SETTINGS_KEY_LAYER_AVARAGE_DURATION_COUNT]))

        if initDesktopPrinterDisplay:
            self._initDesktopPinterDisplay()
        #update new settings
        self._updateDisplay(UPDATE_DISPLAY_REASON_FRONTEND_CALL)
github EricHigdon / OctoPrint-RGB_status / octoprint_rgb_status / __init__.py View on Github external
def on_settings_save(self, data):
        old_strip_settings = {}
        for setting in STRIP_SETTINGS:
            old_strip_settings[setting] = self._settings.get([setting])

        old_idle_settings = {}
        for setting in IDLE_SETTINGS:
            old_idle_settings[setting] = self._settings.get([setting])
        old_disconnected_settings = {}
        for setting in DISCONNECTED_SETTINGS:
            old_disconnected_settings[setting] = self._settings.get([setting])

        changed_settings = plugin.SettingsPlugin.on_settings_save(self, data)
        for setting in STRIP_SETTINGS:
            if old_strip_settings[setting] != self._settings.get([setting]):
                self.init_strip()
                break
        if self._printer.is_operational():
            for setting in IDLE_SETTINGS:
                if old_idle_settings[setting] != self._settings.get([setting]):
                    self.run_idle_effect()
                    break
        else:
            for setting in DISCONNECTED_SETTINGS:
                if old_disconnected_settings[setting] != self._settings.get([setting]):
                    self.run_disconnected_effect()
                    break
        return changed_settings
github google / OctoPrint-LEDStripControl / octoprint_LEDStripControl / __init__.py View on Github external
def on_settings_save(self, data):
		self._logger.debug(u"LEDStripControl on_settings_save()")
		self._unregister_leds()
		# cast to proper types before saving
		for k in ('r', 'g', 'b', 'w'):
			if data.get(k): data[k] = max(0, int(data[k]))
		octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
		self._register_leds()
github sedgett / OctoPrint_IFTTTmaker / octoprint_IFTTTmaker / __init__.py View on Github external
def on_settings_save(self, data):
        octoprint.plugin.SettingsPlugin.on_settings_save(self, data)
        if (hasattr, self._settings, 'makerkey'):
#            self.makerkey = self._settings.get(["makerkey"])
            self._logger.info("Saving IFTTT Maker Key: %s" % self._settings.get(["makerkey"]))
        else:
#            self.makerkey=''
            self._logger.info("No Maker key set while trying to save!")