Notifications via Google Hangouts

I’m using Google Hangouts to get notifications from Home Assistant. I saw a few discussions of if it was possible, or unsupported, so I just wanted to document that I have it working, and the couple issues I had setting it up.

Summary:
Use the XMPP platform, and use JIDs as recipients, not emails.

First, I set up a new email that I use for all my automated notifications. I logged into that email, in the gmail web UI, and started a hangouts chat with anyone I wanted to be able to send messages to. Those people need to accept invitations. Send a few messages back and forth, to make sure everything is connected.

Then I added these to my secrets.yaml:

xmpp_username: [email protected]
xmpp_password: CcwAXbZe5rUoqE7hwzNE
steve_jid: [email protected]
melanie_jid: [email protected]

Where MyAutomationEmail is the new email address I just set up to send the messages, and steve_jid and melanie_jis are the JIDs of the recipients. This was the biggest issue I had setting this all up. I was using email addresses for recipients, and it worked for some, but not others. I still have no idea why it sometimes worked, but the JIDs worked every time.

Once I knew this, finding the JID was the hardest part. The best method I have is to log in using a third party client like Pidgin, and then view info for that person. The JID will be a 26 alphanumeric string that looks like this: [email protected]. I was also able to get the roster including JIDs from SleekXMPP in a Python console, but using Pidgin is much easier. I think JIDs are specific to both the recipient, and the user logged in, so log in with the same email you’ll be sending messages from.

I poked around the gmail web UI for a while, looking for the JID, but couldn’t find it. If anyone knows of an easier way please let me know.

From there it’s straight forward. Add the notify block to your configuration.yaml:

notify:
  - platform: xmpp
    name: melanie_hangouts
    sender: !secret xmpp_username
    password: !secret xmpp_password
    recipient: !secret melanie_jid
  - platform: xmpp
    name: steve_hangouts
    sender: !secret xmpp_username
    password: !secret xmpp_password
    recipient: !secret steve_jid

And then an automation using it:


- alias: Basement Light Left On
  trigger:
  - entity_id: sensor.basement_light
    platform: numeric_state
    above: 40
    for:
      minutes: 20
  action:
  - service: notify.steve_hangouts
    data:
      message: The basement lights are on
  - service: notify.melanie_hangouts
    data:
      message: The basement lights are on

That’s it. It’s working very well for me, and once I knew the JID stuff it’s very easy to set up. The messages go to both the gmail web ui if you have it open, and your phone if you have Hangouts.

4 Likes

There are more people working on Hangouts :grinning:
https://github.com/home-assistant/home-assistant/pull/16049

This is amazing! I use Hangouts as my primary messaging platform.

Anyone know if the integration will stop working when google is moving to Google Chat?

1 Like

I can confirm it still works :slight_smile:

1 Like