power: add timer support to the RFDevice

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-11-15 07:05:08 -05:00
parent 18c6ff5a99
commit c3400bd237
1 changed files with 4 additions and 0 deletions

View File

@ -467,6 +467,9 @@ class GpioDevice(PowerDevice):
logging.exception(msg)
raise self.server.error(msg) from None
self.state = state
self._check_timer()
def _check_timer(self):
if self.state == "on" and self.timer is not None:
event_loop = self.server.get_event_loop()
power: PrinterPower = self.server.lookup_component("power")
@ -521,6 +524,7 @@ class RFDevice(GpioDevice):
logging.exception(msg)
raise self.server.error(msg) from None
self.state = state
self._check_timer()
# This implementation based off the work tplink_smartplug