#6 UI Updates senden und anzeigen

This commit is contained in:
David Zingg 2019-11-20 21:14:42 +01:00
parent 79bc4eb897
commit 799c6b5406

View File

@ -50,18 +50,18 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self._logger.info(self.ip) self._logger.info(self.ip)
self._logger.info(self.intervall) self._logger.info(self.intervall)
self._logger.info("Starting timer.") self._logger.info("Starting timer.")
self._timer = RepeatedTimer(self.intervall, self._timer_task) self._timer = RepeatedTimer(self.intervall, self._timer_task)
self._timer.start() self._timer.start()
def _timer_task(self): def _timer_task(self):
if self.ip is not None: if self.ip is not None:
self._logger.debug("send Request")
try: try:
request = requests.get( request = requests.get(
'http://{}/report'.format(self.ip), timeout=1) 'http://{}/report'.format(self.ip), timeout=1)
self._logger.debug(request.json()) self._logger.debug(request.json())
#self._plugin_manager.send_plugin_message(self._identifier, # self._plugin_manager.send_plugin_message(self._identifier,
# request.json()) # request.json())
except (requests.exceptions.ConnectionError, ValueError): except (requests.exceptions.ConnectionError, ValueError):
self._logger.info('Connection Error Host: {}'.format(self.ip)) self._logger.info('Connection Error Host: {}'.format(self.ip))