Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: xiao-s3-new
- friendly_name: Xiao-S3-New
- platformio_options:
- board_build.flash_mode: dio
- on_boot:
- - priority: -100
- then:
- - wait_until: api.connected
- - light.turn_on: ledd
- - delay: 250ms
- - light.turn_off: ledd
- - delay: 1s
- - light.turn_on: ledd
- - delay: 2s
- - light.turn_off: ledd
- esp32:
- #board: seeed_xiao_esp32s3
- board: esp32-s3-devkitc-1
- variant: esp32s3
- flash_size: 8MB
- framework:
- type: esp-idf
- version: recommended
- sdkconfig_options:
- CONFIG_ESP32_S3_BOX_BOARD: "y"
- psram:
- mode: octal # Please change this to quad for N8R2 and octal for N16R8
- speed: 80MHz
- # Enable logging
- logger:
- # Enable Home Assistant API
- api:
- encryption:
- key: "Hfx1jqxdXsPYLLIvgFu/Qz8Trn3rAl1sV13PX0TxsVc="
- on_client_connected:
- then:
- - delay: 50ms
- - light.turn_on: ledd
- - delay: 2s
- - light.turn_off: ledd
- - micro_wake_word.start:
- on_client_disconnected:
- then:
- - voice_assistant.stop:
- ota:
- password: "a2b6e8adb2f89847eb5dfe0f306183d0"
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Xiao-S3-New Fallback Hotspot"
- password: "opgX7pFduQmu"
- fast_connect: on
- power_save_mode: none
- manual_ip:
- static_ip: 192.168.1.50
- gateway: 192.168.1.1
- subnet: 255.255.255.0
- dns1: 192.168.1.1
- on_connect:
- then:
- - micro_wake_word.start:
- - light.turn_on: ledd
- - delay: 250ms
- - light.turn_off: ledd
- - delay: 500ms
- - light.turn_on: ledd
- - delay: 250ms
- - light.turn_off: ledd
- captive_portal:
- output:
- - id: rgb_GREEN
- platform: ledc
- pin:
- number: 2
- inverted: true
- - id: rgb_RED
- platform: ledc
- pin:
- number: 3
- inverted: true
- - id: rgb_BLUE
- platform: ledc
- pin:
- number: 1
- inverted: true
- - id: light_output
- #platform: gpio
- platform: ledc
- pin: GPIO21
- inverted: true
- light:
- - platform: rgb
- name: "RGB Lights"
- id: RGB_Lights
- red: rgb_RED
- green: rgb_GREEN
- blue: rgb_BLUE
- default_transition_length: 0s
- effects:
- - pulse:
- name: "Slow Pulse"
- transition_length: 250ms
- update_interval: 250ms
- min_brightness: 50%
- max_brightness: 100%
- - pulse:
- name: "Fast Pulse"
- transition_length: 100ms
- update_interval: 100ms
- min_brightness: 50%
- max_brightness: 100%
- #- platform: binary
- - platform: monochromatic
- name: "LED"
- id: ledd
- output: light_output
- default_transition_length: 250ms
- effects:
- - strobe:
- name: Slow Strobe
- colors:
- - state: true
- brightness: 100%
- duration: 500ms
- - state: false
- duration: 500ms
- - strobe:
- name: Fast Strobe
- colors:
- - state: true
- brightness: 100%
- duration: 100ms
- - state: false
- duration: 100ms
- - pulse:
- name: "Slow Pulse"
- transition_length: 250ms
- update_interval: 250ms
- min_brightness: 50%
- max_brightness: 100%
- - pulse:
- name: "Fast Pulse"
- transition_length: 100ms
- update_interval: 100ms
- min_brightness: 50%
- max_brightness: 100%
- button:
- - platform: restart
- name: "Restart"
- id: but_rest
- i2s_audio:
- - id: i2s_in # For microphone
- i2s_lrclk_pin: 6 #WS
- i2s_bclk_pin: 5 #SCK
- - id: i2s_out #For Speaker
- i2s_lrclk_pin: 8 #LRC
- i2s_bclk_pin: 9 #BLCK
- adf_pipeline:
- - platform: i2s_audio
- type: audio_out
- id: adf_i2s_out
- i2s_audio_id: i2s_out
- i2s_dout_pin: 44
- - platform: i2s_audio
- type: audio_in
- id: adf_i2s_in
- i2s_audio_id: i2s_in
- pdm: false
- i2s_din_pin: 4
- channel: left
- sample_rate: 16000
- bits_per_sample: 16bit
- microphone:
- - platform: adf_pipeline
- id: mic
- pipeline:
- - adf_i2s_in
- - self
- #speaker:
- #- platform: i2s_audio
- #id: external_speaker
- #dac_type: external
- #i2s_audio_id: i2s_in
- #i2s_dout_pin: 4
- #mode: mono
- media_player:
- - platform: adf_pipeline
- id: spk
- name: idf_player-mini
- internal: false
- pipeline:
- - self
- - adf_i2s_out
- on_play:
- - light.turn_on:
- id: ledd
- brightness: 100%
- effect: "Slow Pulse"
- on_pause:
- - light.turn_off: ledd
- on_idle:
- - micro_wake_word.start:
- external_components:
- - source: my_components
- - source:
- type: git
- url: https://github.com/gnumpi/esphome_audio
- ref: main
- components: [ adf_pipeline, i2s_audio ]
- refresh: 0s
- micro_wake_word:
- on_wake_word_detected:
- - voice_assistant.start:
- wake_word: !lambda return wake_word;
- silence_detection: true
- - light.turn_on:
- id: RGB_Lights
- effect: "Slow Pulse"
- red: 80%
- green: 0%
- blue: 80%
- brightness: 100%
- model: okay_nabu
- voice_assistant:
- id: va
- microphone: mic
- #speaker: external_speaker
- media_player: spk
- use_wake_word: false
- noise_suppression_level: 4
- auto_gain: 31dBFS
- volume_multiplier: 8.0
- on_listening:
- - light.turn_on:
- id: ledd
- brightness: 100%
- #effect: "Slow Strobe"
- on_stt_vad_end:
- - light.turn_on:
- id: RGB_Lights
- effect: "Fast Pulse"
- red: 80%
- green: 0%
- blue: 80%
- brightness: 100%
- on_stt_end:
- - light.turn_on:
- id: RGB_Lights
- effect: "Fast Pulse"
- red: 80%
- green: 0%
- blue: 80%
- brightness: 100%
- - logger.log:
- format: "I heard : %s"
- args: ['x.c_str()']
- level: INFO
- #on_tts_stream_start:
- #- light.turn_on:
- #id: ledd
- #effect: "Slow Strobe"
- #on_tts_stream_end:
- #- light.turn_off: ledd
- on_error:
- - micro_wake_word.start:
- #on_idle:
- #- light.turn_off: ledd
- on_tts_end:
- #- delay: 3s
- - wait_until:
- not:
- - voice_assistant.is_running:
- #- media_player.is_playing:
- #- delay: 1s
- on_end:
- then:
- - light.turn_off: RGB_Lights
- - light.turn_off: ledd
- - micro_wake_word.start:
- #on_client_connected:
- #- light.turn_on: ledd
- #- delay: 2s
- #- light.turn_off: ledd
- #on_client_disconnected:
- #- if:
- #condition:
- #switch.is_on: use_wake_word
- #then:
- #- micro_wake_word.stop:
- #on_tts_stream_start:
- #- light.turn_off:
- #id: RGB_Lights
- #- voice_assistant.stop:
- #- delay: 1s
- #- voice_assistant.start_continuous:
- switch:
- - platform: template
- name: Mute Microphone
- id: use_wake_word
- optimistic: true
- restore_mode: RESTORE_DEFAULT_OFF
- entity_category: config
- on_turn_off:
- - micro_wake_word.start:
- - light.turn_off: ledd
- on_turn_on:
- - micro_wake_word.stop:
- - voice_assistant.stop
- - lambda: id(va).set_use_wake_word(false);
- - light.turn_on:
- id: ledd
- brightness: 50%
Advertisement
Add Comment
Please, Sign In to add comment