Fix binary sensor exception (#27)

This commit is contained in:
Shay Levy 2022-03-01 18:46:28 +02:00 committed by GitHub
parent 2fc521bee4
commit a299ca4db9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,8 @@ class RPiGPIOBinarySensor(BinarySensorEntity):
def edge_detected(port):
"""Edge detection handler."""
self.hass.add_job(self.async_read_gpio)
if self.hass is not None:
self.hass.add_job(self.async_read_gpio)
edge_detect(self._port, edge_detected, self._bouncetime)