added TimeTrigger upon activation
This commit is contained in:
@@ -15,4 +15,10 @@ class TimeTrigger(Trigger):
|
||||
return datetime.strptime(self.config.custom_config['endTime'], '%H:%M').time()
|
||||
|
||||
def run(self) -> None:
|
||||
self.active = self.start_time() <= datetime.now().time() <= self.end_time()
|
||||
active_current = self.active
|
||||
active_new = self.start_time() <= datetime.now().time() <= self.end_time()
|
||||
if not active_current and active_new:
|
||||
self.log.info("activating trigger, start time: %s, end time: %s, governor: %s", self.start_time(), self.end_time(), self.governor.name)
|
||||
elif active_current and not active_new:
|
||||
self.log.info("deactivating trigger, start time: %s, end time: %s, governor: %s", self.start_time(), self.end_time(), self.governor.name)
|
||||
self.active = active_new
|
||||
|
||||
Reference in New Issue
Block a user