HA Voice Preview Edition Toslink digital audio output

Using my SPDIF digital audio PR I non-intrusively added a Toslink digital audio port to my Home Assistant Voice Preview Edition via the Grove port. The wiring was super simple – just a Grove connector wire I cut and soldered to an optical Toslink transmitter.

I’m now streaming perfect 48KHz digital audio from Music Assistant to our office’s high-end MSB Technology DAC.

This is the config I’m using:

packages:
  remote_package_shorthand: github://esphome/home-assistant-voice-pe/home-assistant-voice.yaml@dev

esphome:
  name: home-assistant-voice
  friendly_name: Home Assistant Voice
  name_add_mac_suffix: false

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true # Required for hidden AP

external_components:
  - source: github://pr#8065
    components: [ i2s_audio, spdif_audio ]
    refresh: 0s

i2s_audio:
  - id: !remove i2s_output
  - id: i2s_output_spdif

speaker:
  - id: !remove i2s_audio_speaker
  - id: spdif_speaker
    platform: spdif_audio
    i2s_audio_id: i2s_output_spdif
    data_pin: GPIO1 # Grove port SDA pin
    sample_rate: 48000
    timeout: never
    buffer_duration: 80ms
    fill_silence: true
    debug: true

switch:
  - platform: gpio
    pin: GPIO46
    id: grove_port_power
    restore_mode: ALWAYS_ON
    setup_priority: 1001

media_player:
  - id: !extend nabu_media_player
    name: Media Player
    audio_dac: !remove
    volume_increment: !remove
    volume_min: !remove
    volume_max: !remove

You’ll see in this config it’s using two of my PRs to support this. Hopefully this can all get merged in before too long!

Add `id` to the `speaker` component by johnboiles · Pull Request #294 · esphome/home-assistant-voice-pe · GitHub (this one is merged now!)

5 Likes