From 8cf059e7e86b47d5950bc5902430daea68fd7234 Mon Sep 17 00:00:00 2001 From: Tarunpreet Ubhi Date: Mon, 1 Jun 2020 09:45:33 -0700 Subject: [PATCH] Update alexa_talking_clock.py --- apps/alexa_talking_clock/alexa_talking_clock.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/alexa_talking_clock/alexa_talking_clock.py b/apps/alexa_talking_clock/alexa_talking_clock.py index 84e3975..a369cf6 100644 --- a/apps/alexa_talking_clock/alexa_talking_clock.py +++ b/apps/alexa_talking_clock/alexa_talking_clock.py @@ -75,12 +75,12 @@ def configure(self, kwargs): self.run_every(self.time_announce, self.next_start, (60 * self.frequency.interval)) - log_message = f"\nINIT - ALEXA TALKING CLOCK\n" + \ + log_message = f"\n**** INIT - ALEXA TALKING CLOCK ****\n" + \ f" START {self.time_start.strftime('%H:%M')}\n" + \ f" END {self.time_end.strftime('%H:%M')}\n" + \ f" NEXT {str(self.next_start.strftime('%H:%M'))}\n" + \ f" FREQUENCY {str(self.frequency.announce_times)}\n" - self.log(log_message) + self.debug_log(log_message) if self.debug: self.time_announce(None) @@ -167,7 +167,7 @@ def time_announce_alexa(self, kwargs): message = effects_speech self.call_service("notify/alexa_media", data = {"type": announce, "method": method}, target = alexa, title = title, message = message) - self.log(f"TIME_ANNOUNCE {time_speech}: {alexa.split('.')[1]}") + self.debug_log(f"TIME_ANNOUNCE {time_speech}: {alexa.split('.')[1]}") def set_effects(self, time_speech): @@ -226,6 +226,10 @@ def time_outside_range(self, now, start, end): return not result + def debug_log(self, message): + if self.debug: + self.log(message) + class Frequency: def __init__(self):