#24 API Token Support
This commit is contained in:
parent
330577cc6e
commit
be81f64ec1
@ -4,7 +4,7 @@
|
|||||||
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
|
<list default="true" id="7e2e0eec-b22e-4d48-8f24-196d1ed9b51a" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/__init__.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/setup.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" beforeDir="false" afterPath="$PROJECT_DIR$/octoprint_mystromswitch/templates/mystromswitch_settings.jinja2" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -49,13 +49,6 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1574193087583</updated>
|
<updated>1574193087583</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00048" summary="#14 Einstellungen reorganisieren">
|
|
||||||
<created>1574873809876</created>
|
|
||||||
<option name="number" value="00048" />
|
|
||||||
<option name="presentableId" value="LOCAL-00048" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1574873809876</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00049" summary="#14 Einstellungen reorganisieren - Beschreibungen angepasst">
|
<task id="LOCAL-00049" summary="#14 Einstellungen reorganisieren - Beschreibungen angepasst">
|
||||||
<created>1574874286229</created>
|
<created>1574874286229</created>
|
||||||
<option name="number" value="00049" />
|
<option name="number" value="00049" />
|
||||||
@ -392,7 +385,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1593630096392</updated>
|
<updated>1593630096392</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="97" />
|
<task id="LOCAL-00097" summary="#21 Add PowerOFF when print is finished">
|
||||||
|
<created>1593630227011</created>
|
||||||
|
<option name="number" value="00097" />
|
||||||
|
<option name="presentableId" value="LOCAL-00097" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1593630227011</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="98" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="UnknownFeatures">
|
<component name="UnknownFeatures">
|
||||||
|
@ -19,6 +19,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ip = None
|
self.ip = None
|
||||||
|
self.token = ""
|
||||||
self.intervall = 1
|
self.intervall = 1
|
||||||
self.onOffButtonEnabled = False
|
self.onOffButtonEnabled = False
|
||||||
self.powerOnOnStart = False
|
self.powerOnOnStart = False
|
||||||
@ -50,6 +51,9 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
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)
|
||||||
|
|
||||||
|
self.token = self._settings.get(["token"])
|
||||||
|
self._logger.debug("token: %s" % self.token)
|
||||||
|
|
||||||
self.intervall = self._settings.get_int(["intervall"])
|
self.intervall = self._settings.get_int(["intervall"])
|
||||||
self._logger.debug("intervall: %s" % self.intervall)
|
self._logger.debug("intervall: %s" % self.intervall)
|
||||||
|
|
||||||
@ -345,13 +349,16 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
self.lastShutdown = False
|
self.lastShutdown = False
|
||||||
self.lastPowerOff = False
|
self.lastPowerOff = False
|
||||||
self.rememberShutdown = False
|
self.rememberShutdown = False
|
||||||
|
if current <= 5:
|
||||||
|
self.token = ""
|
||||||
|
|
||||||
def get_settings_version(self):
|
def get_settings_version(self):
|
||||||
return 5
|
return 6
|
||||||
|
|
||||||
def get_settings_defaults(self):
|
def get_settings_defaults(self):
|
||||||
return dict(
|
return dict(
|
||||||
ip=None,
|
ip=None,
|
||||||
|
token="",
|
||||||
intervall=1,
|
intervall=1,
|
||||||
onOffButtonEnabled=False,
|
onOffButtonEnabled=False,
|
||||||
powerOnOnStart=False,
|
powerOnOnStart=False,
|
||||||
@ -367,7 +374,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
|
|
||||||
def get_settings_restricted_paths(self):
|
def get_settings_restricted_paths(self):
|
||||||
return dict(admin=[
|
return dict(admin=[
|
||||||
['ip']
|
['ip', 'token']
|
||||||
])
|
])
|
||||||
|
|
||||||
def on_settings_save(self, data):
|
def on_settings_save(self, data):
|
||||||
|
@ -7,6 +7,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('API Token') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="input-block-level" data-bind="value: settings.plugins.mystromswitch.token">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">Refresh Intervall</label>
|
<label class="control-label">Refresh Intervall</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
Loading…
Reference in New Issue
Block a user