From c4d3e6b4672645b665cb09f3be36b22d259196a2 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 17 Jul 2018 23:51:30 +0200 Subject: [PATCH] Graceful sleep between failed serial read attempts --- platypush/plugins/serial/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platypush/plugins/serial/__init__.py b/platypush/plugins/serial/__init__.py index 0a9c964427..dbd7694dc3 100644 --- a/platypush/plugins/serial/__init__.py +++ b/platypush/plugins/serial/__init__.py @@ -1,5 +1,6 @@ import json import serial +import time from platypush.plugins import Plugin, action from platypush.plugins.gpio.sensor import GpioSensorPlugin @@ -88,6 +89,7 @@ class SerialPlugin(GpioSensorPlugin): try: ser = self._get_serial() except: + time.sleep(1) ser = self._get_serial(reset=True) data = self._read_json(ser)