#9 Relais ausschalten wenn Octoprint heruntergefahren wird

#7 Relais einschalten wenn Octoprint gestartet wurde
This commit is contained in:
David Zingg 2019-11-25 19:53:43 +01:00
parent 37c09bd288
commit 70355683b2

View File

@ -104,7 +104,7 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
if (newState == True): if (newState == True):
value = '1' value = '1'
request = requests.post( request = requests.post(
'http://{}/timer'.format(self.ip), data={'mode': value, 'time': time}, timeout=1) 'http://{}/timer'.format(self.ip), json={'mode': value, 'time': time}, timeout=1)
if not request.status_code == 200: if not request.status_code == 200:
self._logger.info("Could not powerCycle Relais, Http Status Code: {}".format(request.status_code)) self._logger.info("Could not powerCycle Relais, Http Status Code: {}".format(request.status_code))
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError: