Room Awareness Automation with ESPresense and Amazon Echo Dots

Hello everyone, I wanted to share my recent experience setting up a room-aware audio system using ESPresense and Amazon Echo Dots. This project has been a fantastic way to enhance my home automation setup, and I’d love to hear your thoughts or suggestions!

The Goal:
I have an Echo Dot in each room of my home, named accordingly (e.g., media_player.echo_office, media_player.echo_bedroom). My aim was to ensure that notifications and announcements always play from the Echo Dot in the room I’m currently in. To achieve this, I utilized ESPresense, which provides room presence data through a custom sensor called sensor.avPhone. This sensor updates its state based on my location, which is detected through ESPresense.

The Challenge:
Initially, I faced the challenge of dynamically routing notifications to the correct Echo Dot based on my location. I wanted to avoid hardcoding specific devices and instead have the system automatically detect my presence and route audio accordingly.

The Solution:
After some research and experimentation, I developed a script that listens for state changes on the sensor.avPhone entity. When my location changes, the script updates a virtual switch in Home Assistant, which in turn triggers an automation to route notifications to the appropriate Echo Dot.

Here’s a simplified version of the script I created:

python

Example script logic

if sensor.avPhone.state == ‘office’:
notify.media_player.echo_office
elif sensor.avPhone.state == ‘bedroom’:
notify.media_player.echo_bedroom

… and so on for each room

This script is triggered by a state change on sensor.avPhone, ensuring that notifications always go to the correct device.

Handling Edge Cases:
I also wanted to handle scenarios where I’m not at home or in areas without ESPresense coverage (like the bathroom). To address this, I added logic to redirect notifications to a default device (like my phone) when I’m away or in an unsupported area.

Results:
This setup has been incredibly effective! Notifications now follow me throughout the house, providing a seamless experience. It’s been a joy to see how this simple automation has improved my daily interactions with technology.

Next Steps:
I’m considering expanding this system to include music playback and other audio-related tasks. If anyone has experience with similar setups or suggestions for improvement, I’d love to hear from you!

Thanks for reading, and happy automating! :smile: