Skip to content

Instantly share code, notes, and snippets.

@mattkasa
Created May 22, 2023 21:25
Show Gist options
  • Save mattkasa/83eb96b1590735f3fd9fbbd14a7ca0a0 to your computer and use it in GitHub Desktop.
Save mattkasa/83eb96b1590735f3fd9fbbd14a7ca0a0 to your computer and use it in GitHub Desktop.
substitutions:
name: korvo-1
friendly_name: "Korvo 1"
ip_address: 192.168.1.101
wifi_ssid: iot
power_save: high
esphome:
name: ${name}
platformio_options:
board_build.flash_mode: dio
external_components:
- source: github://esphome/esphome@dev
components: [ esp32_rmt_led_strip ]
- source: github://rpatel3001/esphome@media_player
components: [ i2s_audio, i2s_audio/media_player ]
- source: github://rpatel3001/esphome@es8311
components: [ es8311 ]
- source: github://rpatel3001/esphome@es7210
components: [ es7210 ]
esp32:
board: esp32s3box
framework:
type: esp-idf
variant: ESP32S3
wifi:
power_save_mode: ${power_save}
fast_connect: true
reboot_timeout: 10min
ssid: ${wifi_ssid}
password: !secret wifi_password
manual_ip:
static_ip: ${ip_address}
gateway: 192.168.1.1
subnet: 255.255.255.0
dns1: 192.168.1.1
ap:
ssid: ${name}
password: !secret ap_password
text_sensor:
- platform: wifi_info
ip_address:
name: "${friendly_name} IP Address"
time:
platform: homeassistant
id: homeassistant_time
api:
ota:
logger:
i2c:
sda: GPIO1
scl: GPIO2
scan: true
es8311:
address: 0x18
es7210:
address: 0x40
output:
- platform: gpio
id: pa_ctrl
pin: GPIO38
i2s_audio:
- id: codec
i2s_lrclk_pin: GPIO41 #ws
i2s_bclk_pin: GPIO40 #clk
i2s_mclk_pin: GPIO42
- id: mic_adc
i2s_lrclk_pin: GPIO9 #ws
i2s_bclk_pin: GPIO10 #clk
i2s_mclk_pin: GPIO20
speaker:
- platform: i2s_audio
id: external_speaker
dac_type: external
i2s_audio_id: codec
i2s_dout_pin: GPIO39
mode: mono
microphone:
- platform: i2s_audio
id: external_mic
adc_type: external
i2s_audio_id: mic_adc
i2s_din_pin: GPIO11
pdm: false
voice_assistant:
microphone: external_mic
speaker: external_speaker
light:
- platform: esp32_rmt_led_strip
id: led_ring
name: "${friendly_name} Light"
pin: GPIO19
num_leds: 12
rmt_channel: 0
rgb_order: GRB
chipset: ws2812
default_transition_length: 0s
effects:
- pulse:
name: "Pulse"
transition_length: 0.5s
update_interval: 0.5s
- addressable_twinkle:
name: "Working"
twinkle_probability: 5%
progress_interval: 4ms
- addressable_color_wipe:
name: "Wakeword"
colors:
- red: 0%
green: 100%
blue: 0%
num_leds: 12
add_led_interval: 20ms
reverse: false
binary_sensor:
- platform: template
name: "${friendly_name} Volume Up"
id: btn_volume_up
- platform: template
name: "${friendly_name} Volume Down"
id: btn_volume_down
- platform: template
name: "${friendly_name} Set"
id: btn_set
- platform: template
name: "${friendly_name} Play"
id: btn_play
- platform: template
name: "${friendly_name} Mode"
id: btn_mode
- platform: template
name: "${friendly_name} Record"
id: btn_record
on_press:
- output.turn_on: pa_ctrl
- voice_assistant.start:
- light.turn_on:
id: led_ring
brightness: 50%
effect: "Wakeword"
on_release:
- voice_assistant.stop:
- output.turn_off: pa_ctrl
- light.turn_off:
id: led_ring
sensor:
- id: button_adc
platform: adc
internal: true
pin: 8
attenuation: 11db
update_interval: 15ms
filters:
- median:
window_size: 5
send_every: 5
send_first_at: 1
- delta: 0.1
on_value_range:
- below: 0.55
then:
- binary_sensor.template.publish:
id: btn_volume_up
state: ON
- above: 0.65
below: 0.92
then:
- binary_sensor.template.publish:
id: btn_volume_down
state: ON
- above: 1.02
below: 1.33
then:
- binary_sensor.template.publish:
id: btn_set
state: ON
- above: 1.43
below: 1.77
then:
- binary_sensor.template.publish:
id: btn_play
state: ON
- above: 1.87
below: 2.15
then:
- binary_sensor.template.publish:
id: btn_mode
state: ON
- above: 2.25
below: 2.56
then:
- binary_sensor.template.publish:
id: btn_record
state: ON
- above: 2.8
then:
- binary_sensor.template.publish:
id: btn_volume_up
state: OFF
- binary_sensor.template.publish:
id: btn_volume_down
state: OFF
- binary_sensor.template.publish:
id: btn_set
state: OFF
- binary_sensor.template.publish:
id: btn_play
state: OFF
- binary_sensor.template.publish:
id: btn_mode
state: OFF
- binary_sensor.template.publish:
id: btn_record
state: OFF
switch:
- platform: restart
name: "${friendly_name} Restart"
id: reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment