Skip to content

Commit

Permalink
Update alexa_talking_clock.py
Browse files Browse the repository at this point in the history
  • Loading branch information
UbhiTS authored Jun 1, 2020
1 parent 93f2aa3 commit 8cf059e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/alexa_talking_clock/alexa_talking_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 8cf059e

Please sign in to comment.