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.
Table of Contents
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.
Being one of the most popular messaging apps, WhatsApp ensures widespread familiarity. This means a reduced learning curve for homeowners.
Receive immediate alerts about home activities. Whether it’s security breaches or energy usage spikes, you’re informed instantly.
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.
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.
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
In the Add text field paste in the following repository URL and click the Add button
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.
Open WhatsApp from your phone then go to the Settings page and click on the QRCode icon.
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“.
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
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).
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.
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.
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!
Receive alerts tailored to your needs. Whether it’s a door left open or a sudden temperature drop, stay updated.
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.
- 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.
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?
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.
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.