Skip to content
Home » Home Assistant: Send notifications and messages via WhatsApp

Home Assistant: Send notifications and messages via WhatsApp

Advertisements

Some of the links shared in this post are affiliate links. If you click on the link and make a purchase, we will receive an affiliate commission at no additional cost to you.


Home Assistant is an open source platform for home automation that makes it possible to control and monitor a wide range of smart devices and services in a central system. By integrating over 2000 devices and services, Home Assistant offers a flexible solution for the automation of lighting, heating, security systems and more.

WhatsApp can also be integrated to send messages and notifications. The best thing about it: it’s completely free of charge.

Send WhatsApp messages with Home Assistant

To enable Home Assistant to send WhatsApp messages, we need to create a notification service. Before that, however, we need to obtain the required API access data.

CallMeBot – Request API access

To send the WhatsApp messages as Home Assistant notifications, we used the CallMeBot service. For each number that is to receive messages from Home Assistant via WhatsApp, the steps below must be followed. Requesting the access data is really easy:

  1. Add the phone number +34 684 783 347 to your phone contacts. (The name is freely selectable)
  2. Send this message “I allow callmebot to send me messages” to the newly created contact (via WhatsApp, of course)
  3. Wait until you receive the message “API Activated for your phone number. Your APIKEY is 123123” from the bot.

Note: If you have not received the ApiKey within 2 minutes, please try again after 24 hours.

Home Assistant Notify Service Create

To create the Notify Service for Home Assistant, we need to add the following code to Configuration.yaml, of course with the customized values.

notify:
  - name: WhatsApp  #The name can be chosen freely
    platform: rest
    resource: https://api.callmebot.com/whatsapp.php
    data:
      source: HA
      phone:  +34123123123    #Your phone number with international area code (+49 for Germany )
      apikey: 456789         #Your API Key

Once the configuration.yaml has been saved, Home Assistant must be restarted, a simple reload is not sufficient here. Messages can then be sent, e.g. via automations using the Notify block. This example automation switches on the air conditioning when the air purifier measures a temperature of over 25 degrees in the room. I am then also informed of this via a WhatsApp message.

Leave a Reply

Your email address will not be published. Required fields are marked *

Mastodon