Poll input cards (in case of unreliable interrupt).
authorBenjamin Braatz <benjamin.braatz@graph-it.com>
Mon, 3 Jan 2022 12:04:43 +0000 (13:04 +0100)
committerBenjamin Braatz <benjamin.braatz@graph-it.com>
Mon, 3 Jan 2022 12:04:43 +0000 (13:04 +0100)
controlpi_plugins/pcf8574.py

index fe3924e92d27f46eae3ef2196b1f3f916c7fc62a..d981440da77fae13bfc5d1036167046d382fd6c5 100644 (file)
@@ -166,5 +166,7 @@ class InputCard(BasePlugin):
                                                   'state': new_state}))
 
     async def run(self) -> None:
-        """Run no code proactively."""
-        pass
+        """Poll I2C state (in case interrupt doesn't work)."""
+        while True:
+            await asyncio.sleep(0.05)
+            self._read()