The Matter standard enables smart home devices from different manufacturers to work together in a reliable and secure way. One common use case is detecting when a door is opened or closed and announcing this event through Google Home speakers or sending notifications to connected devices.
This article demonstrates how to configure Google Home to announce door events using Matter-compatible sensors such as the Aqara Door and Window Sensor P2. The example uses Google Home script automations to broadcast voice announcements and trigger mobile notifications whenever the entrance door changes state.
Requirements
- A Matter-compatible door and window sensor.
- A Google Speaker for announcements.
- The Google Home application with the script editor enabled, accessible via the web interface at https://home.google.com/ .
Door Closed Announcement Script
The following script broadcasts a voice message and sends a notification when the door transitions to the closed state (sensor reports openPercent = 0
):
metadata:
name: Door closed announcement
description: Announce when the door is closed
automations:
- starters:
- type: device.state.OpenClose
device: Entrance door - Entryway
state: openPercent
is: 0
actions:
- type: assistant.command.Broadcast
message: The door was closed
- type: home.command.Notification
title: The door was closed
body: The door was closed
Code language: YAML (yaml)
Note: Replace "Entrance door - Entryway"
in the scripts with the actual name of the Matter-compatible door and window sensor as configured in Google Home. The device name must match exactly for the automations to work correctly.
When the door closes, the Google Assistant broadcasts “The door was closed” on all Google Home devices in the household, and a push notification with the same text is sent to connected mobile devices.
Door Open Announcement Script
The following script performs the same action when the door opens (sensor reports openPercent = 100
):
metadata:
name: Door open announcement
description: Announce when the door is open
automations:
- starters:
- type: device.state.OpenClose
device: Entrance door - Entryway
state: openPercent
is: 100
actions:
- type: assistant.command.Broadcast
message: The door was opened
- type: home.command.Notification
title: The door was opened
body: The door was opened
Code language: YAML (yaml)
Note: Replace "Entrance door - Entryway"
in the scripts with the actual name of the Matter-compatible door and window sensor as configured in Google Home. The device name must match exactly for the automations to work correctly.
In this case, Google Assistant announces “The door was opened” and the same message is sent as a push notification.
Conclusion
Combining a Matter-compatible door sensor with Google Home scripts provides real-time feedback whenever a door is opened or closed. It delivers both audible alerts throughout the home and push notifications to mobile devices, enhancing awareness and security.