Exploring Smart Home Automation with Squeezebox Alerts

I’ve been diving into the world of smart home automation, and I wanted to share a project I recently completed. I created a script that allows my Squeezebox music player to play locally stored MP3 files through Home Assistant automations. The script is designed to set an ‘alert volume’ and resume previously playing music after the alert has finished. It even restores the previous volume, repeat setting, and on/off state of the player. This has been incredibly useful for notifications, such as when the basement door is open or the gate is triggered.

Here’s how I set it up:

  1. Script Overview: The script uses a locally stored MP3 file that combines a beep sound with a voice alert generated from an online TTS service. For example, it plays “The basement door is open” when triggered.

  2. Integration with Home Assistant: I integrated the script into Home Assistant using shell commands. The script takes three parameters: the MAC address of the Squeezebox player, the full path to the MP3 file, and the alert volume. Here’s an example of how I set it up in my automations:

yaml
automation:

  • alias: “Play kitchen alert on gate opened”
    trigger:
    • platform: state
      entity_id: sensor.gate
      to: ‘open’
      action:
    • service: shell_command.play_gate_opened_alert_in_kitchen
  1. Script Details: The script first checks the current state of the Squeezebox player, including power, volume, and repeat settings. It then plays the alert song at the specified volume and resumes the previous state afterward. This ensures that the music experience isn’t disrupted by the alert.

  2. Customization: I’ve customized the script to work with multiple Squeezebox players in different rooms, allowing me to send alerts to specific locations based on the trigger.

This project has been a great way to enhance my home security and daily convenience. I’m excited to see how I can expand this further with additional sensors and automations. If anyone has questions or suggestions, I’d love to hear them!