UbhiTS / ad-alexatalkingclock

Alexa (or other Smart Speakers) tell you the time without asking every hour. Please ⭐️if you like my app :)
https://www.youtube.com/c/ubhits
Apache License 2.0
38 stars 6 forks source link

missing prefix in configuration #8

Closed metamah7 closed 4 years ago

metamah7 commented 4 years ago

Thx for your job.

This is the good configuration :

alexa_talking_clock: module: alexa_talking_clock class: AlexaTalkingClock alexas:

A prefix "announce_" was missing in half_hour and quarter_hour.

UbhiTS commented 4 years ago

Hi, thanks for your suggestion. That's why I have announcements as the parent config. Don't you think that adding an announce_ to half and quarter hour would be redundant ? It's saying Announce > Half Hour, Announce > Quarter Hour. I feel that it easy to understand as well as keep the total size of the config small and pleasant to look at. One target of mine always is to keep the config a bit concise so anyone doesn't get intimidated looking at it :)

markbooth73 commented 4 years ago

Hi, Sorry to hijack this thread but i am having trouble getting quarter_hour: true to work.

By default I see in the sample config it is set to true but log shows

2020-04-25 17:38:33.197800 INFO alexa_talking_clock: INITIALIZED: Start [07:00], End [21:00], Next [18:00], Freq [0, 30]
alexa_talking_clock:
  module: alexa_talking_clock
  class: AlexaTalkingClock
  alexas:
    - media_player.mark_s_echo_dot
    - media_player.mark_s_2nd_echo_dot
  voice:
    volume_offset: 0 # -40 to 4, default 0
    pitch_offset: 0 # -33 to 50, default 0
    rate: 100 # 20 to 250, default 100
    whisper: false
  announcements:
    bell: true
    start_time: "07:00:00"
    end_time: "21:00:00"
    half_hour: true
    quarter_hour: true
  debug: false
metamah7 commented 4 years ago

Try adding the prefix "announce_" to the two variables "half_hour" and "quarter_hour" and it will work.

markbooth73 commented 4 years ago

Half hour works as is though?

Sent from Yahoo Mail on Android

On Sat, 25 Apr 2020 at 18:04, metamah7notifications@github.com wrote:

Try adding the prefix "announce_" to the two variables "half_hour" and "quarter_hour" and it will work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

UbhiTS commented 4 years ago

sorry guys, I found the bug, I had renamed the half_hour and quarter_hour parameters in the config, but forgotten to rename them in code. Released v2.0.3, can you please take latest and test now.

UbhiTS commented 4 years ago

now i realize what @metamah7 was saying, sorry I misunderstood your first message in the thread.

metamah7 commented 4 years ago

works fine now ;).

UbhiTS commented 4 years ago

Thanks guys, a careless mistake on my part. Please forgive and forget ;)

markbooth73 commented 4 years ago

Yes, Confirmed. One thing I would like to see though is that it plays an announcement on startup? I know you inputted some lines on our live chat but cannot remember what you did?

UbhiTS commented 4 years ago

if you set debug to true, it

debug True bool False Announces time instantly when you save the apps.yaml. Also, when set, will not honor start and end times and speak throughout the day and night
markbooth73 commented 4 years ago

I did see that but "Also, when set, will not honor start and end times and speak throughout the day and night" Why?

UbhiTS commented 4 years ago

This is just to set the debug configuration and make sure you are satisfied with the alexa voice as well as ensure that the app is working as expected without scheduling. Once you are satisfied, you can set debug = false

markbooth73 commented 4 years ago

Could you just have it play a notification on startup as it initialises along with the text

2020-04-25 18:26:35.023080 INFO alexa_talking_clock: INITIALIZED: Start [07:00], End [21:00], Next [18:30], Freq [0, 15, 30, 45]

    log_message = f"INITIALIZED: " + \
      f"Start [{str(self.start_hour).zfill(2)}:{str(self.start_minute).zfill(2)}], " + \
      f"End [{str(self.end_hour).zfill(2)}:{str(self.end_minute).zfill(2)}], " + \
      f"Next [{str(self.next_start.strftime('%H:%M'))}], " + \
      f"Freq {str(self.frequency.announce_times)}"
    self.log(log_message)
UbhiTS commented 4 years ago
    log_message = f"INITIALIZED: " + \
      f"Start [{str(self.start_hour).zfill(2)}:{str(self.start_minute).zfill(2)}], " + \
      f"End [{str(self.end_hour).zfill(2)}:{str(self.end_minute).zfill(2)}], " + \
      f"Next [{str(self.next_start.strftime('%H:%M'))}], " + \
      f"Freq {str(self.frequency.announce_times)}"
    self.log(log_message)

    if self.debug: self.time_announce(None)

you can remove the

if self.debug:

and it should announce everytime on startup

markbooth73 commented 4 years ago

how to add custom announcement?

UbhiTS commented 4 years ago

Do you just want to announce when you home assistant restarts ? I've done that too, in a seperate controller. Is that what you want to do ?

markbooth73 commented 4 years ago

Hi Chief, Alexa Talking Clock Initialized.

.

UbhiTS commented 4 years ago

you can add the below lines in bold and red

seconds = 0
for alexa in self.alexas:
  seconds = seconds + 5
  self.run_in(self.announce_time, seconds, alexa = alexa, time_speech = "Hi Chief, Alexa Talking Clock Initialized!", msg = "Hi Chief, Alexa Talking Clock Initialized.")

Screenshot below

[cid:f9ed1e58-9f2f-4ace-a001-0447fbef7928]


From: markbooth73 notifications@github.com Sent: Saturday, April 25, 2020 12:02 PM To: UbhiTS/ad-alexatalkingclock ad-alexatalkingclock@noreply.github.com Cc: Tarunpreet Ubhi ubhits@outlook.com; State change state_change@noreply.github.com Subject: Re: [UbhiTS/ad-alexatalkingclock] missing prefix in configuration (#8)

Hi Chief, Alexa Talking Clock Initialized.

.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/UbhiTS/ad-alexatalkingclock/issues/8#issuecomment-619426019, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA47TZJPQCULZHS3R65BKNDROMXTRANCNFSM4MQX4UNQ.

markbooth73 commented 4 years ago

Hi,

Sorry to be a pain but I cannot see the screenshot

I placed the text in the /config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py at line 31

2020-04-26 10:38:35.741456 INFO AppDaemon: Terminating alexa_talking_clock

2020-04-26 10:38:35.746870 INFO AppDaemon: Reloading Module: /config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py

2020-04-26 10:38:35.748954 INFO AppDaemon: Loading App Module: alexa_talking_clock

2020-04-26 10:38:35.752597 WARNING Error: ------------------------------------------------------------

2020-04-26 10:38:35.753262 WARNING Error: Unexpected error loading module: /config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py:

2020-04-26 10:38:35.753840 WARNING Error: ------------------------------------------------------------

2020-04-26 10:38:35.755331 WARNING Error: Traceback (most recent call last):

File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 566, in read_app

importlib.reload(self.modules[module_name])

KeyError: 'alexa_talking_clock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 788, in check_app_updates

await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"])

File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 276, in run_in_executor

response = future.result()

File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run

result = self.fn(*self.args, **self.kwargs)

File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 571, in read_app

self.read_app(file)

File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 580, in read_app

self.modules[module_name] = importlib.import_module(module_name)

File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "", line 1014, in _gcd_import

File "", line 991, in _find_and_load

File "", line 975, in _find_and_load_unlocked

File "", line 671, in _load_unlocked

File "", line 779, in exec_module

File "", line 916, in get_code

File "", line 846, in source_to_code

File "", line 219, in _call_with_frames_removed

File "/config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py", line 33

seconds = seconds + 5

^

IndentationError: expected an indented block

2020-04-26 10:38:35.755926 WARNING Error: ------------------------------------------------------------

2020-04-26 10:38:35.756713 WARNING AppDaemon: Removing associated apps:

2020-04-26 10:38:35.757376 WARNING AppDaemon: alexa_talking_clock

From: Tarunpreet Ubhi notifications@github.com Sent: 25 April 2020 22:17 To: UbhiTS/ad-alexatalkingclock ad-alexatalkingclock@noreply.github.com Cc: markbooth73 mark.booth@yahoo.co.uk; Comment comment@noreply.github.com Subject: Re: [UbhiTS/ad-alexatalkingclock] missing prefix in configuration (#8)

you can add the below lines in bold and red

seconds = 0 for alexa in self.alexas: seconds = seconds + 5 self.run_in(self.announce_time, seconds, alexa = alexa, time_speech = "Hi Chief, Alexa Talking Clock Initialized!", msg = "Hi Chief, Alexa Talking Clock Initialized.")

Screenshot below

[cid:f9ed1e58-9f2f-4ace-a001-0447fbef7928]


From: markbooth73 <notifications@github.com mailto:notifications@github.com > Sent: Saturday, April 25, 2020 12:02 PM To: UbhiTS/ad-alexatalkingclock <ad-alexatalkingclock@noreply.github.com mailto:ad-alexatalkingclock@noreply.github.com > Cc: Tarunpreet Ubhi <ubhits@outlook.com mailto:ubhits@outlook.com >; State change <state_change@noreply.github.com mailto:state_change@noreply.github.com > Subject: Re: [UbhiTS/ad-alexatalkingclock] missing prefix in configuration (#8)

Hi Chief, Alexa Talking Clock Initialized.

.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/UbhiTS/ad-alexatalkingclock/issues/8#issuecomment-619426019, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA47TZJPQCULZHS3R65BKNDROMXTRANCNFSM4MQX4UNQ.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/UbhiTS/ad-alexatalkingclock/issues/8#issuecomment-619441846 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKBOCBW2QVINQF7VRE3M7DRONHNZANCNFSM4MQX4UNQ . https://github.com/notifications/beacon/AOKBOCAAT3KZLBCSFQERNE3RONHNZA5CNFSM4MQX4UN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOETV65NQ.gif

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus