Sydney Staff SRE or something.

Google Home Calendar Announcements

· by Robert Mibus · Read in about 2 min · (315 Words)

We have a couple of Google Homes for our house’s common areas, and for Christmas all of our kids got Google Home Minis for their rooms.

One of the problems in our household is simply remembering when to do basic things - when to start cooking dinner, and whose turn it is. Noticing that it’s bedtime for the kids and making sure they head off to their rooms.

So - we have networked speakers in rooms and I’m already running http://home-assistant.io on a Raspberry Pi. Surely home automation is the solution! (Isn’t it always? ;)

I already have Google Calendar integration configured, and the Home devices all show up as Chromecast (media_player) targets.

Proposal: I have a calendar of events, and at the start time of an event just say it’s name on all speakers. Example: a 7AM calendar notification for “OK everybody, time to get up!”.

After a bunch of poking, I’ve learned some stuff:

  • Sometimes notifications can be quite delayed (up to ~10mins); I haven’t seen a cause yet.
  • Calendar data is synchronized less frequently than you might expect.
  • data_template can’t be configured via the UI, but a quick poke at the YAML can fix that one line.
  • home-assistant can’t reliably cast to a Chromecast Device Group - I am guessing this is this pychromecast bug.
  • If you play media to a home-assistant group of a set of Chromecasts, a failure of one to play (e.g. it’s offline) can stop any of them playing.

So, my current automation (with three outputs):

- action:            
  - data_template:
      entity_id: media_player.kitchen_home
      message: '{{ states.calendar.chores.attributes.message }}'
    service: tts.google_say
  - data_template:
      entity_id: media_player.bedroom_1_speaker
      message: '{{ states.calendar.chores.attributes.message }}'     
    service: tts.google_say         
  - data_template:
      entity_id: media_player.bedroom_2_speaker
      message: '{{ states.calendar.chores.attributes.message }}'
    service: tts.google_say
  alias: Regular Reminders
  condition:
  - condition: state
    entity_id: calendar.chores
    state: 'on'
  id: '1518565910349'
  trigger:
  - entity_id: calendar.chores
    from: 'off'
    platform: state
    to: 'on'
  - platform: template
    value_template: '{{ states.calendar.chores.attributes.message }}'