#5 Rest Api integration

- Nullpointer fix
This commit is contained in:
David Zingg 2019-11-20 20:18:16 +01:00
parent b01097ec16
commit 2ce950e2da

View File

@ -24,8 +24,6 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self.ctx.check_hostname = False self.ctx.check_hostname = False
self.ctx.verify_mode = ssl.CERT_NONE self.ctx.verify_mode = ssl.CERT_NONE
self.initialize()
def initialize(self): def initialize(self):
self.ip = self._settings.get(["ip"]) self.ip = self._settings.get(["ip"])
self._logger.debug("ip: %s" % self.ip) self._logger.debug("ip: %s" % self.ip)
@ -71,6 +69,16 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
def on_shutdown(self): def on_shutdown(self):
self._logger.info("Hello World!") self._logger.info("Hello World!")
def on_settings_load(self):
self._logger.info("on_settings_load")
self.initialize()
def on_settings_migrate(self, target, current):
pass
def get_settings_version(self):
return 1
def get_settings_defaults(self): def get_settings_defaults(self):
return dict( return dict(
ip=None, ip=None,