Servus,
bezüglich meines Projektes einer normalen Konversation mit dem Homeassistant Assistenten habe ich nun einen neuen Ansatz gefunden. Vlt kann mir hier jemand weiterhelfen wie ich die URL irgendwie abgreifen kann.
Das hier ist der Code von meinem ESP
esphome:
name: "esp32-microphone-assist"
friendly_name: "esp32-microphone-assist"
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# level: VERY_VERBOSE
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxx"
ota:
- platform: esphome
password: "xxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Test Fallback Hotspot"
password: "xxxxx"
captive_portal:
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO26 #WS
i2s_bclk_pin: GPIO25 #SCK
microphone:
- platform: i2s_audio
adc_type: external
pdm: false
id: mic_i2s
channel: right
bits_per_sample: 32bit
i2s_audio_id: i2s_in
i2s_din_pin: GPIO33 #SD Pin from the INMP441 Microphone
voice_assistant:
microphone: mic_i2s
id: va
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 4.0
use_wake_word: false
# on_wake_word_detected:
# - light.turn_on:
# id: led_light
# on_listening:
# - light.turn_on:
# id: led_light
# effect: "Scan Effect With Custom Values"
# red: 63%
# green: 13%
# blue: 93%
# on_stt_end:
# - light.turn_on:
# id: led_light
# effect: "None"
# red: 0%
# green: 100%
# blue: 0%
on_error:
# - light.turn_on:
# id: led_light
# effect: "None"
- if:
condition:
switch.is_on: use_wake_word
then:
- switch.turn_off: use_wake_word
- delay: 1sec
- switch.turn_on: use_wake_word
on_tts_start:
- homeassistant.service:
service: script.ha_voice_alexa
data:
media_player_id: 'media_player.echo_buro'
tts_id: 'tts.home_assistant_cloud'
lang: 'de-DE'
voice_agent: 'ChristophNeural'
messagecall: !lambda 'return x;'
on_client_connected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_client_disconnected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
# on_end:
# - light.turn_off:
# id: led_light
binary_sensor:
- platform: status
name: API Connection
id: api_connection
filters:
- delayed_on: 1s
on_press:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_release:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
switch:
- platform: template
name: Use wake word
id: use_wake_word
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
entity_category: config
on_turn_on:
- lambda: id(va).set_use_wake_word(true);
- if:
condition:
not:
- voice_assistant.is_running
then:
- voice_assistant.start_continuous
on_turn_off:
- voice_assistant.stop
- lambda: id(va).set_use_wake_word(false);
Und das ist das vorhandene Script das die relevanten Daten vom ESP in HA abgreift.
alias: ha_voice_alexa
sequence:
- data_template:
media_player_entity_id: "{{ media_player_id }}"
entity_id: "{{ tts_id }}"
language: "{{ lang }}"
options:
voice: "{{ voice_agent }}"
message: "{{ messagecall }}"
action: tts.speak
mode: single
Das hier ist ein Auszug aus dem LOG des ESP:
gelb = meine Frage
blaue = die Antwort vom Assist
Grün = Variablen für das Script in HomeAssistant
Rot = der mp3 Pfad der noch über ein script integriert werden muss.
Gemini und Chatgpt habe ich dazu schon gequält aber irgendwie hat mich das diesmal nicht weiter gebracht.
Danke euch schon mal vorab.