GithubHelp home page GithubHelp logo

ubhits / ad-alexatalkingclock Goto Github PK

View Code? Open in Web Editor NEW
37.0 3.0 6.0 116 KB

Alexa (or other Smart Speakers) tell you the time without asking every hour. Please ⭐️if you like my app :)

Home Page: https://www.youtube.com/c/ubhits

License: Apache License 2.0

Python 100.00%
appdaemon-apps appdaemon apps app home-automation homeassistant home-assistant hass alexa alexa-voice-service media-player mediaplayer time time-tracker hacs alexa-media-player amazon-alexa assistant smarthome smart-home

ad-alexatalkingclock's Introduction

Alexa (& Friends) Reminders & Talking Clock 🐔

hacs_badge

New Features and Updates - v3.0

User Defined Reminders

Let Alexa be your personal assistant and give you personal reminders. Reminder Schedule can be Daily, Weekdays, Weekends, or Mon, Tue, Wed, Thu, Fri, Sat, Sun

Local Language

Time Alerts and Reminders in your Local Language

Sonos Support

Set bell:false and remove the voice effects section (kudos to @5and0)

Whisper, Pitch, Volume, Rate and Bell Controls

Set "Bell" to False and "Rate" to 50 for a creepy announcement. Awesome for Halloween, or just to scare someone!

Multiple Speakers

Target multiple speakers in your home with one app

NOTE: 💥Please update your apps.yaml with the new configuration structure💥

Amazon Alexa, Google Home, Sonos (or other smart speakers) will keep on reminding you of the time from morning till night and also courteously greet with a good morning, good afternoon, and a good night & sweet dreams all without you having to lift a finger (or speak a word). Sweet!

Please ⭐ this repo if you like my work and also check out my other repos like

Also, if you want to see a walkthrough of my Home Assistant configuration, I have my video walkthrough on youtube below

Installation

Needs the Alexa Media Player or Sonos integration

Use HACS or download the alexa_talking_clock.py from inside the apps directory to your local apps directory, and add the following configuration to enable the app.

App Configuration (config/appdaemon/apps/apps.yaml)

alexa_talking_clock:
  module: alexa_talking_clock
  class: AlexaTalkingClock
  alexas:
    - media_player.kitchen_alexa
    - media_player.master_bedroom_alexa
  announcements:
    bell: true  # for SONOS, set to False
    start_time: "07:30:00"
    end_time: "21:30:00"
    half_hour: true
    quarter_hour: true
    default_speech: "It's {time}." # {day} {date} and {time} can be used. Can be defined in your local language
  voice: # for SONOS, remove this section
    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
  reminders:
    # daily
    - schedule: "daily, 07:30:00" 
      reminder: "Good morning. Today is {day}, {date}, and it's {time}."
    - schedule: "daily, 12:00:00"
      reminder: "Good afternoon. Today is {day}, {date}, and it's {time}."
    - schedule: "daily, 17:00:00"
      reminder: "Good evening. It's {time}."
    - schedule: "daily, 21:30:00"
      reminder: "It's {time}. Good night. And sweet dreams."
    # weekdays
    - schedule: "weekdays, 09:30:00"
      reminder: "It's {time}. Quick reminder. Did you go to gym today?"
    # weekends
    - schedule: "weekends, 09:30:00"
      reminder: "It's {time}. Question. Are you planning to go for a run or a hike today?"
    # mon, tue, wed, thu, fri, sat, sun
    - schedule: "tue, 21:00:00"
      reminder: "It's {time}. Quick Reminder. Did you take out the garbage?"
    - schedule: "wed, 09:30:00"
      reminder: "It's {time}. What day is it? It's Hump Day! Yaaaay!"
    - schedule: "fri, 04:30:00"
      reminder: "The weekend is almost here. Better plan it now, or waste it forever!"
  debug: false
key optional type default description
module False string alexa_talking_clock The module name of the app.
class False string AlexaTalkingClock The name of the Class.
alexas True list # alexa_media_players # The Alexa (or Sonos) to target for the time reminder speech.
announcements|bell True bool True Enable or disable the Alexa announcement bell before the time speech. For Sonos set to False
announcements|start_time True time 07:30 The time to start announcements. This is in 24h format.
announcements|end_time True time 21:30 The time to end announcements. This is in 24h format.
announcements|half_hour True bool True Announce every half hour (It's 8 AM, It's 8:30 AM, It's 9 AM)
announcements|quarter_hour True bool False Announce every 15 minutes (It's 8 AM, It's 8:15 AM, It's 8:30 AM, It's 8:45 AM, It's 9 AM)
announcements|default_speech True text "It's {time}." Set the time alert as per your preference and in your local language. Remember, you can use {day} {date} {time} placeholders within the text and they will be replaced with actual values when played
voice|volume_offset True int 0 Set between -40 and 4. Default 0
voice|pitch_offset True int 0 Set between -33 and 50. Default 0
voice|rate True int 100 Set between 20 to 250. Default 100
voice|whisper True bool False Whisper Mode
reminders|schedule True schedule, time Reminder Schedule. The frequency can be daily, weekdays, weekends, mon, tue, wed, thu, fri, sat, sun
reminders|reminder True text The text for Alexa to speak at the defined schedule. You can use {day} {date} {time} placeholders within the text and they will be replaced with actual values when played
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

Thank you for your time! (get it ;) 🙌

This app was a result of my amazing wife's request (who is a mother of 2 beautiful princesses BTW) to help her manage her time wisely ;). So this is dedicated to my wife Reena, without whom this world would not be worth my time :)

This also wouldn't be possible without the amazing work done by the developers and community at Home Assistant

A very special thanks to Keaton Taylor and Alan Tse whose work on Alexa Media Player was the basis of my inspiration and my work to code all the above listed apps!

Ever since we've set this up in our home, it has become an indispensable part of our lives. It's amazing to see how a simple reminder of the current time in the day can make people more efficient :), I hope this app helps others as it has helped us.

If you like my work and feel gracious, you can buy me a beer below ;)

Buy Me A Beer

License

Apache-2.0. By providing a contribution, you agree the contribution is licensed under Apache-2.0. This is required for Home Assistant contributions.

ad-alexatalkingclock's People

Contributors

ubhits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ad-alexatalkingclock's Issues

Can't get this working with Sonos speaker

Hi, I am targeting the associated media_player entity that the Alexa Media Player integration has found, I can send tts to this using the notifier service, but unfortunately I don't get announcements from the talking clock :'(

This has worked for me with an echo show device

TimeoutError

Hi,
your system works for me, speaks correctly, but in the error log I always find this message:

`2020-04-12 21:00:10.065653 WARNING alexa_talking_clock: ------------------------------------------------------------

concurrent.futures._base.TimeoutError
raise TimeoutError()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 441, in result
result = future.result(self.AD.internal_function_timeout)
File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 285, in run_coroutine_threadsafe
f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs))
File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 191, in inner_sync_wrapper
self.call_service("notify/alexa_media", data = {"type":"announce", "method":"all"}, target = self.alexa, message = msg)
File "/config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py", line 95, in time_announce
funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"]))
File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 766, in worker
2020-04-12 21:00:10.063241 WARNING alexa_talking_clock: Traceback (most recent call last):
2020-04-12 21:00:10.047554 WARNING alexa_talking_clock: ------------------------------------------------------------
2020-04-12 21:00:10.045504 WARNING alexa_talking_clock: Worker Ags: {'id': 'ab1a0d8af83b495aa32d428d8dca761b', 'name': 'alexa_talking_clock', 'objectid': '5485f12708b64a69984a88d3026f6739', 'type': 'scheduler', 'function': >, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 3600, '__thread_id': 'thread-0'}}
2020-04-12 21:00:10.043761 WARNING alexa_talking_clock: Unexpected error in worker for App alexa_talking_clock:
2020-04-12 21:00:10.042038 WARNING alexa_talking_clock: ------------------------------------------------------------`

Multi Language Support

Hi and thanks, I use this from months and is very nice.
Just a question: would it be easy to accomodate for different languages?
I just inserted the italian phrases into the file, and works, but a more universal approach would be nice.
E.g.

if hour == self.start_hour and minute == self.start_minute and hour <= 11:
  prefix = "Buongiorno."
elif hour == 12 and minute == 0:
  prefix = "Buom pomeriggio."
elif hour == 17 and minute == 0:
  prefix = "Buonasera."
elif hour == self.end_hour and minute == self.end_minute and hour >= 20:
  postfix = "Buonanotte. E dolci sogni."

hour = hour - 12 if hour > 12 else hour

if minute == 0:
  time_speech = f"Sono le {hour} {ampm_str}."
else:
  time_speech = f"Sono le {hour}:{minute:02d} {ampm_str}."

return prefix + " " + time_speech + " " + postfix

Originally posted by @ik0adr in #7 (comment)

speech italian

hi, thanks for the work done. everything works except the "day" and "month" are pronounced in English while I would like them in Italian. how can I do?
this my configuration:

alexa_talking_clock:
module: alexa_talking_clock
class: AlexaTalkingClock
alexas:
- media_player.echo_plus_sala
- media_player.echo_dot_garage

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: "08:00:00"
end_time: "23:00:00"
hour: true
half_hour: false
quarter_hour: true
default_speech: "Sone le {time}."
reminders:
# daily
- schedule: "daily, 08:00:00"
reminder: "Buon giorno. Oggi è il {day}, {date}, e sono le {time}."
- schedule: "daily, 12:00:00"
reminder: "Buon pomeriggio. Oggi è il {day}, {date}, ed è {time}."
- schedule: "daily, 17:00:00"
reminder: "Buona sera. sono le {time}."
- schedule: "daily, 23:00:00"
reminder: "Sone le {time}. Buona notte. e sogni d' oro."

debug: false
thanks

Updates seem to have broken something

Since the updates it seems that I am not able to get Alexa Talking Clock not working. The kids with the CornaVirus were really finding this handy.

This is what I am getting in appdaemon.

2020-04-25 21:58:58.182743 WARNING alexa_talking_clock: ------------------------------------------------------------
2020-04-25 21:58:58.183577 WARNING alexa_talking_clock: Unexpected error running initialize() for alexa_talking_clock
2020-04-25 21:58:58.184296 WARNING alexa_talking_clock: ------------------------------------------------------------
2020-04-25 21:58:58.187903 WARNING alexa_talking_clock: Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 145, in initialize_app
await utils.run_in_executor(self, init)
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 "/config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py", line 31, in initialize
self.alexas = self.args["alexas"]
KeyError: 'alexas'

2020-04-25 21:58:58.188315 WARNING alexa_talking_clock: ------------------------------------------------------------

I have reinstalled both appdaemon, alexa talking clock, and alexa media player. Everything works except the talking clock.

Hoping this is just me and not breaking for everybody.

TypeError: 'NoneType' object is not iterable.

The AlexaTalkingClock has suddenly stopped working, AppDaemon reports this, any ideas?

2020-07-16 08:00:00.028310 WARNING alexa_talking_clock: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 766, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py", line 169, in time_announce time_speech = self.get_time_speech(now) File "/config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py", line 230, in get_time_speech for reminder in self.reminders: TypeError: 'NoneType' object is not iterable

Add Temperature sensor

Is it possible to have alexa speak the current temperature using a tag similar to {time}? This would be helpful for the morning announcements when deciding what to wear.

Unexpected error running initialize() for alexa_talking_clock

Installed app from HACS and running HA 0.108.1, AppDaemon 4

Version 4.0.3

APS.YAML

alexa_talking_clock:
  module: alexa_talking_clock
  class: AlexaTalkingClock
  alexa: media_player.mark_s_echo_dot
  start_hour: 9
  start_minute: 0
  end_hour: 18
  end_minute: 0
  announce_hour: true
  announce_half_hour: true
  announce_quarter_hour: true

LOG
2020-04-09 15:04:11.732667 INFO HASS: Connected to Home Assistant 0.108.1
2020-04-09 15:04:12.956509 INFO HASS: Evaluating startup conditions
2020-04-09 15:04:13.028843 INFO AppDaemon: Processing restart for HASS
2020-04-09 15:04:13.030227 INFO AppDaemon: Terminating alexa_talking_clock
2020-04-09 15:04:13.036417 INFO AppDaemon: Initializing app alexa_talking_clock using class AlexaTalkingClock from module alexa_talking_clock
2020-04-09 15:04:13.048411 INFO alexa_talking_clock: INITIALIZE start:2020-04-09 14:45:00.045255, frequency:15, times:[0, 15, 30, 45]
2020-04-09 15:04:13.052637 WARNING alexa_talking_clock: ------------------------------------------------------------
2020-04-09 15:04:13.053344 WARNING alexa_talking_clock: Unexpected error running initialize() for alexa_talking_clock
2020-04-09 15:04:13.054017 WARNING alexa_talking_clock: ------------------------------------------------------------
2020-04-09 15:04:13.055367 WARNING alexa_talking_clock: Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 145, in initialize_app
await utils.run_in_executor(self, init)
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 "/config/appdaemon/apps/ad-alexatalkingclock/apps/alexa_talking_clock/alexa_talking_clock.py", line 30, in initialize
self.run_every(self.time_announce, self.next_start, (60 * self.frequency.interval))
File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 191, in inner_sync_wrapper
f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs))
File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 285, in run_coroutine_threadsafe
result = future.result(self.AD.internal_function_timeout)
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/usr/lib/python3.8/site-packages/appdaemon/adapi.py", line 2476, in run_every
raise ValueError("start cannot be in the past")
ValueError: start cannot be in the past
2020-04-09 15:04:13.056037 WARNING alexa_talking_clock: ------------------------------------------------------------

Test it

How can u actually test it? Can you add a card to lovelace for this?

Small issue at 21:30

I use this when working late in my office so have it announcing every half hour until 23:30.

I noticed that at 21:30 it repeated the 21:00 message - very simple fix by changing line 102 to

  elif hour == 21 and minute == 0:

Thanks for a great app I'm amazed at how useful it is :)

Issues with schedules

Hi,

If I understand correctly the /config/appdaemon/apps/apps.yaml can be edited to add user defined entries ?

    # daily
    - schedule: "daily, 07:30:00" 
      reminder: "Good morning. Today is {day}, {date}, and it's {time}."
    - schedule: "daily, 12:00:00"
      reminder: "Good afternoon. Today is {day}, {date}, and it's {time}."
    - schedule: "daily, 17:00:00"
      reminder: "Good evening. It's {time}."
    - schedule: "daily, 21:30:00"
      reminder: "It's {time}. Good night. And sweet dreams."

I seem to be having issues as that in edited schedules do not announce.
For example if I add a schedule say for 15:00 it will not announce

    - schedule: "daily, 15:00:00"
      reminder: "Good afternoon. Today is {day}, {date}, and it's {time}."

I restart the appdaemon after every change to the config, I have also tried restart of HA, still the same.

Any thoughts?

AppDaemon 4
Current version: 0.4.3

alexatalkingclock 3.0.2

[feature] Implement Google Home support

I have working Google Home (or any media player supporting TTS)

I would like to use this ticket some configuration details before contributing my code.

Currently the change I implemented is configured by adding the following keys to configure the service and the options needed

With Google Translate TTS

alexa_talking_clock:
  module: alexa_talking_clock
  class: AlexaTalkingClock
  alexas:
    - media_player.google_home_1
  service:
    name: tts/google_translate_say

With Nabu Casa TTS

alexa_talking_clock:
  module: alexa_talking_clock
  class: AlexaTalkingClock
  alexas:
    - media_player.google_home_1
  service:
    name: tts/cloud_say
    options:
      gender: female

What do you think about that ?

The issue I see is that it is not possible to support multiple platforms at the same time (but you can instantiate the app twice if needed)

Whisper Mode and Volume Control

Hello Tarun

Thanks for the wonderful support and the Lovely Alexa Talking Clock.

I have configured it on 4 Alexa Devices and it works perfectly.

Just needed two small features:

  1. Ability to control the volume on a per device basis (in case of multiple devices).
  2. Ability to set Whisper Mode on a per device basis (in case of multiple devices).

Please keep me updated.

Regards
Sajive

missing prefix in configuration

Thx for your job.

This is the good configuration :

alexa_talking_clock:
module: alexa_talking_clock
class: AlexaTalkingClock
alexas:
- media_player.alexa_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: "08:00:00"
end_time: "23:00:00"
announce_half_hour: true
announce_quarter_hour: true
debug: false

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

Configuring Alexa talking CLock

Hi Tarun

Have been struggling with configuring Alexa Talking Clock sice a week but havent been able to make it speak.

Here is my directory structure.

Am i doing something wrong?

Is some reference to be ,made in configuration.yaml?

Please help.

Regards
Sajive Trehan
Zurich - Switzerland

![Screenshot 2020-04-05 11 47 18](https://user-images
Screenshot 2020-04-05 11 50 38
.githubusercontent.com/47938878/78471680-6503b280-7733-11ea-8259-00e6c8fdd16b.png)

Unable to get the time because of service.

Hello,
Just found this app, and thought I'd give it a try. However, after installing the media player and setting up your app, I see the following in my logs. This also happens with the doorbell app as well.
2020-10-16 03:17:50.085689 INFO alexa_talking_clock: TIME_ANNOUNCE It's 3:17 AM.: master_bedroom
2020-10-16 03:17:50.078789 WARNING AppDaemon: Unknown service (default/notify/alexa_media) in call_service from alexa_talking_clock
When I look at services under dev tools, I see notify.alexa_media, as well as notify.alexa_media_my speaker name. I thought it might be adding
notify:

  • platform: alexa_media
    name: alexa_media
    to configuration.yaml but no luck. I'm sure it's an easy fix but I can't figure out what could be causing it. Thought I'd done everything correctly.
    Thanks for any help.
    I'd like to use this with Sonos, and have already set bell to false in apps.yaml.

multiple media players

is it possible to add multiple media players to announce the time and at different times? is so, how? thanks you for this great application. gets me up in time to go to work. love it.

thanks

Notification not on the hour

Hi,

My notifications are not being received on the hour. For example I will get a notification at 09:53 rather than 10. How can this be adjusted?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.