2 Best Methods For Integrating Home Assistant With WhatsApp

Home Assistant WhatsApp Setup Guide for Beginners

Home automation is no longer a thing of science fiction – it’s our reality. The advent of Home Assistant has revolutionized the way we control and interact with our household devices.

But wait, there’s more to it! Have you ever imagined receiving messages from your home appliances through your WhatsApp? That’s where the integration of Home Assistant with WhatsApp steps in.

What is Home Assistant?

Home Assistant is a powerful open-source home automation platform. It allows users to control and automate their smart devices, ensuring a seamless smart home experience. Its versatility lies in its ability to integrate with countless platforms, making the whole automation experience a piece of cake.

The Role of WhatsApp in Home Assistant

The integration of WhatsApp with Home Assistant is like the icing on the cake. It’s as simple as chatting with a friend but here, your friend is your home! This feature brings in the convenience of sending commands to your home devices directly via WhatsApp messages.


Benefits of Home Assistant WhatsApp Integration

There’s no denying that integrating WhatsApp with Home Assistant is a game-changer.

Accessibility

Being one of the most popular messaging apps, WhatsApp ensures widespread familiarity. This means a reduced learning curve for homeowners.

Real-Time Notifications

Receive immediate alerts about home activities. Whether it’s security breaches or energy usage spikes, you’re informed instantly.

Increased Convenience

Imagine this: You’re lying in bed and realized you forgot to turn off the lights downstairs. Instead of getting up, all you need to do is send a WhatsApp message. Boom! Lights out.

Advanced Security Features

Get real-time WhatsApp notifications if there’s an unexpected motion detected at your home or if someone tampers with your smart devices. Always be in the know and ensure your home’s safety.

Seamless Communication with Smart Devices

From adjusting the thermostat to feeding your pet with an automated feeder, command every action through a simple WhatsApp chat.

Engage with your home devices through a platform you already know. No need for multiple apps. Keep it simple.


Setting up the Home Assistant WhatsApp Integration

Taking the plunge into this integration? Here’s your guide to getting started.

Prerequisites

Before diving deep, make sure:

  • Your Home Assistant setup is running smoothly.
  • You have an active WhatsApp account.
  • A stable internet connection is available.

Method 1 – Home Assistant WhatsApp Add-on

This is my preferred method as there is no third party access involved, all messages are sent directly between Home Assistant and WhatsApp Web.

Note

This method requires using the Add-on store which is only available for Home Assistant users who are using Home Assistant OS.

If you do not use Home Assistant OS then choose method 2 which uses the Home Assistant REST API for notifications.

Step-by-step setup guide

Open Home Assistant and then go to Settings -> Add-ons

Click on Add-on Store then the 3 dots in the top right corner and click on Repositories

Manage add-on repositories for Home Assistant

In the Add text field paste in the following repository URL and click the Add button
https://github.com/giuseppecastaldo/ha-addons

Home Assistant repository for WhatsApp enabled

Close the Manage add-on repositories window and search for the WhatsApp add-on in the store then click Install

Once the add-on has been installed click Start then you should see a new notification in Home Assistant that displays a QRCode.

Home Assistant WhatsApp QRCode for client setup

Open WhatsApp from your phone then go to the Settings page and click on the QRCode icon.

WhatsApp QRCode button in settings page

On the QRCode screen in WhatsApp select the Scan code section and then scan the QRCode from Home Assistant. Click on Continue to allow device login then choose Link a device and scan the QRCode again. If all went well you should now see a new device appear under Device status called “Ubuntu“.

WhatsApp linked devices page

Restart Home Assistant

Once Home Assistant has started up add whatsapp: to your configuration.yaml file and then restart Home Assistant.

The setup is now complete and ready to start sending message!

Send a test message

The WhatsApp add-on should have created service named whatsapp.send_message and we are going to use this to send a simple message to yourself.

From Home Assistant go to Developer Tools then select the Services tab.

In the service box type in whatsapp.send_message and then a Service data field should appear.

Click inside the Service data field and paste the following code into the box then click on Call Service.

clientId: default
to: [email protected] # User ID (replace with your phone number using country code at start)
body:
  text: Hello this is a simple text message from Home Assistant
Sending a text message from Home Assistant to a WhatsApp number

More example messages that can be sent

Send an image with a caption

service: whatsapp.send_message
data:
  clientId: default
  to: [email protected]
  body:
    image:
      url: "https://hips.hearstapps.com/hmg-prod/images/cute-cat-photos-1593441022.jpg"
    caption: Cute cat!

Send a location

service: whatsapp.send_message
data:
  clientId: default
  to: [email protected]
  body:
    location:
      degreesLatitude: 51.505554
      degreesLongitude: -0.075278

Send from Home Assistant to WhatsApp Group

To send a message from Home Assistant to a WhatsApp group all you need to do is update the to: line in a message to use the Group ID and change the last part of the address to @g.us instead of @s.whatsapp.net. For example [email protected]

How to locate a WhatsApp Group ID (JID)

To locate a WhatsApp Group ID open the Home Assistant Developer Tools page and go to the Events tab. In the Listen to Events form enter new_whatsapp_message as the event to listen to and click Start Listening.

From another device (not your own) send a message to a WhatsApp group you are a member of and you should see some results like illustrated in the screenshot below. Copy the value after remoteJid: (line 6 in my screenshot below).

Using Home Assistant to find a WhatsApp group ID

Example Automation

This example automation will send a message to a specific person when you arrive home. It can easily be modified to send to a group or when you arrive to any other zone configured within Home Assistant.

- alias: Arrive at home
  description: ""
  trigger:
    - platform: device
      domain: device_tracker
      entity_id: device_tracker.pixel6
      type: enter
      zone: zone.home
  condition: []
  action:
    - service: whatsapp.send_message
      data:
        clientId: default
        to: [email protected]
        body:
          text: Hi, I'm at home where's my dinner?
  mode: single

Method 2 – Use the CallMeBot WhatsApp API for Home Assistant

This method will use a free API provided by CallMeBot.com.

Note

The CallMeBot API method can only be used to send yourself notifications and cannot be used to send messages to other WhatsApp users or groups.

This method is most useful for receiving notifications via WhatsApp.

Step-by-step setup guide

Open WhatsApp from your mobile device and add +34 644 71 81 99 as a new contact then send a message with the text “I allow callmebot to send me messages“.

Wait for a reply with “API Activated for your phone number.  Your APIKEY is XXXX”.

Make a note of your API key then open up your configuration.yaml file from Home Assistant then paste in the following code to create a new nofitication service.

notify:
  - name: WhatsApp
    platform: rest
    resource: https://api.callmebot.com/whatsapp.php
    data:
      source: HA
      phone: +441234567890  #enter your phone number here
      apikey: 123456        #enter your api key here

Save the file then restart Home Assistant.

You should now have a new service available called notify.WhatsApp

Example test message using CallMeBot API

Go to Developer Tools then Services and in the Service box type notify.whatsapp

In the message field type a test message such as “Test message from Home Assistant” then click Call Service.

Home Assistant CallMeBot notification service

Troubleshooting common setup issues

Stuck somewhere? Here are common hitches and how to resolve them:

  • QR Code not scanning? Ensure good lighting and try again.
  • Not receiving notifications? Check if your Home Assistant server has internet access and reconfigure WhatsApp integration settings.
  • Messages not arriving quick enough? In my experience using CallMeBot is much slower than using the add-on from method 1. Try changing your setup to a different method described in this article to find what works best for you.

Features of Home Assistant WhatsApp Integration

This integration isn’t just about turning devices on or off. It’s way more than that!

Customized Notifications

Receive alerts tailored to your needs. Whether it’s a door left open or a sudden temperature drop, stay updated.

Chatbot Interactions

Experience AI-driven chatbot interactions that help in troubleshooting issues or providing smart device insights.

Smart home device control through WhatsApp

Directly chat with your devices. Ask your refrigerator about the grocery list or command your curtains to draw!

Safety Measures with WhatsApp Integration

Safety first! Let’s ensure your data remains private and your home stays secure.

Data Privacy and Security

End-to-end encryption ensures that your commands and notifications remain between you and your home. No third party can intercept.

Best Practices

  • Regularly update both Home Assistant and WhatsApp.
  • Avoid sharing control with unknown numbers.
  • Use strong, unique passwords for all accounts.

Practical Uses and Scenarios

Security and Surveillance

Forgot to activate your security system while rushing for a meeting? No worries! A simple message like, “Activate security mode” on WhatsApp can put your mind at ease.

Entertainment and Lifestyle

Hosting a party? Set the mood by texting, “Play my party playlist and dim the lights” through WhatsApp.

Pressence and Location

Use an automation to uutomatically send messages to someone when you arrive at specific locations such as home or your place of work.

FAQs

What is the main advantage of Home Assistant WhatsApp Integration?

The primary benefit is convenience. It allows users to control their home devices directly from WhatsApp, an app they use daily.

Can I integrate WhatsApp with other home automation systems?

While Home Assistant offers this feature, it’s essential to check with other home automation platforms individually for such integrations.

Is the WhatsApp integration secure?

Absolutely. With end-to-end encryption and stringent data privacy measures, your interactions remain secure.

How do I troubleshoot issues with the integration?

Most issues can be resolved by checking internet connectivity, ensuring both apps are updated, or reconfiguring the integration settings.

Can multiple users control the home using WhatsApp?

Yes, by adding multiple numbers during the setup, various users can have control.

Can I integrate other messaging apps with Home Assistant?

Yes, Home Assistant supports many messaging apps such as Telegram, text messaging and even email.

What’s the cost associated with this integration?

The integration itself is part of the Home Assistant platform, which is open-source. However, certain advanced features might have associated costs.

Conclusion

The Home Assistant WhatsApp integrations outlined in this article open up new possibilities for accessibility, remote control, and creative automations.

While there are some limitations currently, the capabilities are impressive and hint at the future potential of platforms like WhatsApp becoming ubiquitous IoT control hubs blending our digital and physical worlds.

As smart home technology advances, seamless user experiences will be key – and messaging apps like WhatsApp will surely play a leading role.

About Danny

I am the primary editor of the whatsmarthome.com blog where I post helpful articles about smart home products, how-to guides, and much more.

5 thoughts on “2 Best Methods For Integrating Home Assistant With WhatsApp”

  1. Thanks for the integration. I may not use it but it is very useful to others. This free integation will help other Home Assistant users because its free.

    Wonderful work. 🙂

    Reply
  2. My Home Assistant displays this error when trying to install the addon: Failed to install add-on
    ‘f4fdf59d_whatsapp_addon’

    Reply
    • If you still facing this issue there is a quite funny workaround.
      It depends on your OS Version you have installed (as it looks like)
      So for example switching back to 11.2 will fix your problem. You can install the addon.
      With 11.4 the installation failed (at least i faced it). Haven’t tested 11.3
      So procedure is: Fallback to 11.2, install Integration, Update to 11.4.
      Must say I only tested the installation but I see no probs with the integration in 11.4

      Reply
  3. With Method one, would it also be possible to display say the latest 3 messages of a whatsapp group on your home assistant dashboard.
    Even more fun.. have it read out loud when a messages comes in.
    I am thinking of the possibility of having my family app connected and if i want to have something read out loud.. i start the message with HA:
    Then the home assistant will talk.. that would be a very cool feature

    Reply
    • That sounds like a good idea, I will investigate how to display the latest 3 messages and using TTS and reply here if I find anything useful!

      Reply

Leave a Comment