Last active
December 2, 2024 01:19
-
-
Save fortuna/7de464d15ef96f4bb11c25d7f630ce89 to your computer and use it in GitHub Desktop.
Using a custom media player with M5Stack Atom Echo as Voice Assistant on Home Assistant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
name: m5stack-atom-echo | |
friendly_name: M5Stack Atom echo | |
packages: | |
m5stack.atom-echo-wake-word-voice-assistant: github://esphome/wake-word-voice-assistants/m5stack-atom-echo/m5stack-atom-echo.yaml@main | |
esphome: | |
name: ${name} | |
name_add_mac_suffix: true | |
friendly_name: ${friendly_name} | |
api: | |
encryption: | |
key: YOUR_KEY | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# All of the above should be auto generated by tools like https://esphome.io/projects/index.html. | |
# Add the section below to your generated config. | |
# By Vinicius Fortuna. | |
text: | |
# Text configuration to se the media player you want to use for the assistant voice. | |
- platform: template | |
name: "Assistant Media Player" | |
id: assistant_media_player | |
entity_category: CONFIG | |
initial_value: media_player.living_room_sonos | |
# Saves and loads the state to RTC/Flash | |
restore_value: true | |
mode: text | |
optimistic: true | |
voice_assistant: | |
# This removes the speaker entry in the original config. | |
# See https://esphome.io/components/voice_assistant.html#configuration. | |
# There's a media_player option, but I couldn't make it work with the Home Assistant media player. | |
speaker: !remove | |
on_tts_end: | |
# Call the media player as a service. You need to configure the device in the ESPHome integration to | |
# "Allow the device to perform Home Assistant actions". | |
- homeassistant.service: | |
service: media_player.play_media | |
data: | |
entity_id: !lambda "return id(assistant_media_player).state.c_str();" | |
media_content_id: !lambda "return x;" | |
media_content_type: music | |
announce: "true" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment