Skip to content

Instantly share code, notes, and snippets.

@DTTerastar
Created May 5, 2023 21:21
Show Gist options
  • Save DTTerastar/1e322c4c2c4a9038344673a5cf9d853e to your computer and use it in GitHub Desktop.
Save DTTerastar/1e322c4c2c4a9038344673a5cf9d853e to your computer and use it in GitHub Desktop.
esphome:
name: smart-speaker
friendly_name: Smart Speaker
name_add_mac_suffix: false
min_version: 2023.4.4
esp32:
board: esp-wrover-kit
framework:
version: 2.0.5
source: ~3.20005.0
platform_version: platformio/espressif32 @ 5.3.0
type: arduino
variant: ESP32
external_components:
- source: github://pr#3552
components: [es8388]
refresh: 0s
- source: github://pr#4775
components: [adc, i2s_audio, microphone]
refresh: 0s
i2c:
sda: GPIO18
scl: GPIO23
es8388:
logger:
baud_rate: 115200
tx_buffer_size: 512
deassert_rts_dtr: false
hardware_uart: UART0
level: DEBUG
logs: {}
api:
port: 6053
password: ''
reboot_timeout: 15min
ota:
safe_mode: true
port: 3232
reboot_timeout: 5min
num_attempts: 10
wifi:
ap:
password: ${wifi_ap_password}
ap_timeout: 1min
domain: .z13.org
reboot_timeout: 15min
power_save_mode: LIGHT
fast_connect: false
networks:
- ssid: TSI
password: tsiwlan2oo7
priority: 0.0
captive_portal: {}
improv_serial: {}
i2s_audio:
- i2s_lrclk_pin: 25
i2s_bclk_pin: 5
microphone:
- platform: i2s_audio
id: echo_microphone
i2s_din_pin: 35
adc_type: external
pdm: false
media_player:
- platform: i2s_audio
name: ''
id: echo_audio
i2s_dout_pin: 26
mode: mono
disabled_by_default: false
dac_type: external
voice_assistant:
microphone: echo_microphone
on_start:
then:
- light.turn_on:
id: led
blue: 1.0
red: 0.0
green: 0.0
state: true
on_tts_start:
then:
- light.turn_on:
id: led
blue: 0.0
red: 0.0
green: 1.0
state: true
on_tts_end:
then:
- light.turn_on:
id: led
blue: 0.0
red: 0.0
green: 1.0
state: true
- media_player.play_media:
media_url: !lambda |-
return x;
on_end:
then:
- delay: 1s
- if:
condition:
media_player.is_playing: {}
then:
- wait_until:
condition:
media_player.is_idle: {}
- light.turn_off:
id: led
state: false
else:
- light.turn_off:
id: led
state: false
on_error:
then:
- light.turn_on:
id: led
blue: 0.0
red: 1.0
green: 0.0
state: true
- delay: 1s
- light.turn_off:
id: led
state: false
binary_sensor:
- platform: gpio
pin:
number: GPIO12
inverted: true
mode:
input: true
output: false
open_drain: false
pullup: false
pulldown: false
drive_strength: 20.0
name: Button
disabled_by_default: true
entity_category: diagnostic
id: echo_button
on_press:
- then:
- voice_assistant.start: {}
on_release:
- then:
- voice_assistant.stop: {}
- platform: gpio
pin:
number: GPIO19
inverted: true
mode:
input: true
pullup: true
name: ${friendly_name} Volume Up
on_click:
- media_player.volume_up:
- platform: gpio
pin:
number: GPIO32
inverted: true
mode:
input: true
pullup: true
name: ${friendly_name} Volume Down
on_click:
- media_player.volume_down:
light:
- platform: fastled_clockless
id: led
name: ''
disabled_by_default: true
entity_category: config
pin: 22
default_transition_length: 0s
chipset: SK6812
num_leds: 1
rgb_order: GRB
restore_mode: ALWAYS_OFF
gamma_correct: 2.8
flash_transition_length: 0s
sensor:
- platform: adc
pin: GPIO33
name: ${name} Battery
icon: "mdi:battery-outline"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment