I’m still experimenting with this, but still stumped.
I can generate TTS via piper and send it to my Muse Luxe through the Home Assistant Developer Tools services page. It works great and the speech sounds like it should.
I can use the voice_assistant
pipeline and it mostly works - the button works, I can speak and have it correctly interpreted, and Home Assistant executes my command. Great.
But there’s no voice feedback unless I use the speaker
component. (However, the speaker
component is much too loud!)
If I use media_player
there is no sound. BUT Home Assistant sees the media player doing something for a few seconds.
Here’s a bit of my ESPHome log:
[18:33:40][D][sensor:094]: 'Luxe Battery': Sending state 4.27374 V with 3 decimals of accuracy
[18:33:42][D][binary_sensor:036]: 'Luxe Action Button': Sending state ON
[18:33:42][D][voice_assistant:105]: Requesting start...
[18:33:42][D][voice_assistant:085]: Starting...
[18:33:42][D][voice_assistant:123]: Assist Pipeline running
[18:33:42][D][light:035]: 'Luxe Top LED' Setting:
[18:33:42][D][light:046]: State: ON
[18:33:42][D][light:058]: Red: 0%, Green: 0%, Blue: 100%
[18:33:45][D][binary_sensor:036]: 'Luxe Action Button': Sending state OFF
[18:33:45][D][voice_assistant:113]: Signaling stop...
[18:33:46][D][voice_assistant:137]: Speech recognised as: " Turn off the office table lamp."
[18:33:46][D][voice_assistant:152]: Response: "Turned off light"
[18:33:46][D][light:035]: 'Luxe Top LED' Setting:
[18:33:46][D][light:058]: Red: 0%, Green: 100%, Blue: 0%
[18:33:46][D][voice_assistant:167]: Response URL: "http://192.168.17.10:8123/api/tts_proxy/db98156bf572727274889253f275cea21c83824c_en-us_718a3c601f_tts.piper.mp3"
[18:33:46][D][media_player:059]: 'Luxe Media Player' - Setting
[18:33:46][D][media_player:066]: Media URL: http://192.168.17.10:8123/api/tts_proxy/db98156bf572727274889253f275cea21c83824c_en-us_718a3c601f_tts.piper.mp3
[18:33:46][D][light:035]: 'Luxe Top LED' Setting:
[18:33:46][D][light:058]: Red: 0%, Green: 100%, Blue: 0%
[18:33:46][D][light:108]: Effect: 'Fast Pulse'
[18:33:46][D][voice_assistant:172]: Assist Pipeline ended
[18:33:50][D][light:035]: 'Luxe Top LED' Setting:
[18:33:50][D][light:046]: State: OFF
[18:33:50][D][light:108]: Effect: 'None'
And the corresponding section from the Home Assistant logbook:
Luxe Media Player changed to Idle
2:33:50 PM - 8 minutes ago
Luxe Media Player changed to Playing
2:33:46 PM - 8 minutes ago
Luxe Action Button turned off
2:33:45 PM - 8 minutes ago
Luxe Action Button turned on
2:33:42 PM - 8 minutes ago
This looks exactly like it should! There’s roughly four seconds where the media player is playing. But again, there’s no sound.
And if I use the services page in Home Assistant to generate some TTS again, it still works. So I don’t think it’s a muting/volume problem.
Here’s my current yaml:
substitutions:
name: "raspiaudio-muse-luxe-1"
friendly_name: "RaspiAudio Muse Luxe"
esphome:
name: "${name}"
name_add_mac_suffix: false
project:
name: raspiaudio.muse-luxe
version: "1.0cw"
min_version: 2023.5.0
on_boot:
priority: 800
then:
- output.turn_off: amp_power # OFF until WiFi comes online to avoid loud static burst
- wait_until:
wifi.connected:
- delay: 1s
- output.turn_on: amp_power
- delay: 1s
- media_player.volume_set: 30%
esp32:
board: esp-wrover-kit
framework:
type: arduino
api:
encryption:
key: (REDACTED)
services:
- service: start_va
then:
- voice_assistant.start:
- service: stop_va
then:
- voice_assistant.stop:
logger:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
captive_portal:
improv_serial:
external_components:
- source: github://pr#3552 # DAC support https://github.com/esphome/esphome/pull/3552
components: [es8388]
refresh: 0s
es8388:
i2c:
sda: GPIO18
scl: GPIO23
i2s_audio:
- i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO5
output:
- platform: gpio
pin:
number: 21
mode: OUTPUT
id: amp_power
globals:
- id: wifi_connected
type: bool
initial_value: "false"
restore_value: no
- id: first_run
type: bool
initial_value: "true"
restore_value: no
interval:
- interval: 1s # slow pulse amber light until WiFi connected on startup
then:
- if:
condition:
lambda: 'return id(first_run);'
then:
- light.turn_on:
id: top_led
effect: "Slow Pulse"
red: 100%
green: 60%
blue: 0%
- globals.set:
id: first_run
value: "false"
- if:
condition:
and:
- lambda: 'return !id(wifi_connected);'
- wifi.connected:
then:
- globals.set:
id: wifi_connected
value: "true"
- light.turn_on:
id: top_led
effect: "Fast Pulse"
red: 0%
green: 100%
blue: 0%
- delay: 1.0s
- light.turn_off: top_led
# speaker:
# - platform: i2s_audio
# id: luxe_speaker
# dac_type: external
# i2s_dout_pin: GPIO26
# mode: stereo
media_player:
- platform: i2s_audio
name: Luxe Media Player
id: luxe_media
dac_type: external
i2s_dout_pin: GPIO26
mode: stereo
mute_pin:
number: GPIO21
inverted: true
# on_play: # turn on the amp only when needed to prevent pops
# then:
# - output.turn_on: amp_power
# on_idle:
# then:
# - output.turn_off: amp_power
microphone:
- platform: i2s_audio
id: luxe_microphone
i2s_din_pin: GPIO35
adc_type: external
pdm: false
voice_assistant:
microphone: luxe_microphone
# speaker: luxe_speaker
on_start:
then:
- light.turn_on:
id: top_led
blue: 100%
red: 0%
green: 0%
effect: none
on_tts_start:
then:
- light.turn_on:
id: top_led
blue: 0%
red: 0%
green: 100%
effect: none
on_tts_end:
then:
- media_player.play_media:
id: luxe_media
media_url: !lambda 'return x;'
- light.turn_on:
id: top_led
blue: 0%
red: 0%
green: 100%
effect: "Fast Pulse"
on_end:
then:
- delay: 1s
- wait_until:
not:
media_player.is_playing:
# speaker.is_playing:
- light.turn_off: top_led
on_error:
then:
- light.turn_on:
id: top_led
blue: 0%
red: 100%
green: 0%
effect: none
- delay: 1s
- light.turn_off: top_led
sensor:
- platform: adc
pin: GPIO33
name: Luxe Battery
icon: "mdi:battery-outline"
device_class: voltage
state_class: measurement
entity_category: diagnostic
unit_of_measurement: V
update_interval: 15s
accuracy_decimals: 3
attenuation: 11db
raw: true
filters:
- multiply: 0.00173913 # 2300 -> 4, for attenuation 11db, based on Olivier's code
- exponential_moving_average:
alpha: 0.2
send_every: 2
- delta: 0.002
binary_sensor:
- platform: gpio
pin:
number: GPIO19
inverted: true
mode:
input: true
pullup: true
name: Luxe Volume Up
on_click:
then:
- media_player.volume_up:
- platform: gpio
pin:
number: GPIO32
inverted: true
mode:
input: true
pullup: true
name: Luxe Volume Down
on_click:
then:
- media_player.volume_down:
- platform: gpio
pin:
number: GPIO12
inverted: true
mode:
input: true
output: false
open_drain: false
pullup: false
pulldown: false
drive_strength: 20.0
name: Luxe Action Button
disabled_by_default: false
entity_category: diagnostic
id: middle_button
on_press:
- then:
- voice_assistant.start:
on_release:
- then:
- voice_assistant.stop:
light:
- platform: neopixelbus
id: top_led
name: Luxe Top LED
internal: True
pin: GPIO22
default_transition_length: 0s
variant: SK6812
num_leds: 1
type: GRB
restore_mode: ALWAYS_OFF
gamma_correct: 2.8
flash_transition_length: 0s
effects:
- pulse:
name: "Fast Pulse"
transition_length: 0.1s
update_interval: 0.2s
- pulse:
name: "Slow Pulse"
transition_length: 0.5s
update_interval: 1s
Ideas appreciated.