mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
commit
cadbf7463e
7 changed files with 58 additions and 1 deletions
|
@ -48,6 +48,8 @@ RUN \
|
|||
libfreetype-dev=2.12.1+dfsg-5 \
|
||||
libssl-dev=3.0.11-1~deb12u2 \
|
||||
libffi-dev=3.4.4-1 \
|
||||
libopenjp2-7=2.5.0-2 \
|
||||
libtiff6=4.5.0-6 \
|
||||
cargo=0.66.0+ds1-1 \
|
||||
pkg-config=1.8.1-1 \
|
||||
gcc-arm-linux-gnueabihf=4:12.2.0-3; \
|
||||
|
|
|
@ -40,6 +40,8 @@ const EntityBase *MQTTLockComponent::get_entity() const { return this->lock_; }
|
|||
void MQTTLockComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {
|
||||
if (this->lock_->traits.get_assumed_state())
|
||||
root[MQTT_OPTIMISTIC] = true;
|
||||
if (this->lock_->traits.get_supports_open())
|
||||
root[MQTT_PAYLOAD_OPEN] = "OPEN";
|
||||
}
|
||||
bool MQTTLockComponent::send_initial_state() { return this->publish_state(); }
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ CONF_ON_STT_VAD_END = "on_stt_vad_end"
|
|||
CONF_ON_STT_VAD_START = "on_stt_vad_start"
|
||||
CONF_ON_TTS_END = "on_tts_end"
|
||||
CONF_ON_TTS_START = "on_tts_start"
|
||||
CONF_ON_TTS_STREAM_START = "on_tts_stream_start"
|
||||
CONF_ON_TTS_STREAM_END = "on_tts_stream_end"
|
||||
CONF_ON_WAKE_WORD_DETECTED = "on_wake_word_detected"
|
||||
|
||||
CONF_SILENCE_DETECTION = "silence_detection"
|
||||
|
@ -56,6 +58,17 @@ IsRunningCondition = voice_assistant_ns.class_(
|
|||
"IsRunningCondition", automation.Condition, cg.Parented.template(VoiceAssistant)
|
||||
)
|
||||
|
||||
|
||||
def tts_stream_validate(config):
|
||||
if CONF_SPEAKER not in config and (
|
||||
CONF_ON_TTS_STREAM_START in config or CONF_ON_TTS_STREAM_END in config
|
||||
):
|
||||
raise cv.Invalid(
|
||||
f"{CONF_SPEAKER} is required when using {CONF_ON_TTS_STREAM_START} and/or {CONF_ON_TTS_STREAM_END}"
|
||||
)
|
||||
return config
|
||||
|
||||
|
||||
CONFIG_SCHEMA = cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
|
@ -105,8 +118,15 @@ CONFIG_SCHEMA = cv.All(
|
|||
cv.Optional(CONF_ON_STT_VAD_END): automation.validate_automation(
|
||||
single=True
|
||||
),
|
||||
cv.Optional(CONF_ON_TTS_STREAM_START): automation.validate_automation(
|
||||
single=True
|
||||
),
|
||||
cv.Optional(CONF_ON_TTS_STREAM_END): automation.validate_automation(
|
||||
single=True
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA),
|
||||
tts_stream_validate,
|
||||
)
|
||||
|
||||
|
||||
|
@ -222,6 +242,20 @@ async def to_code(config):
|
|||
config[CONF_ON_STT_VAD_END],
|
||||
)
|
||||
|
||||
if CONF_ON_TTS_STREAM_START in config:
|
||||
await automation.build_automation(
|
||||
var.get_tts_stream_start_trigger(),
|
||||
[],
|
||||
config[CONF_ON_TTS_STREAM_START],
|
||||
)
|
||||
|
||||
if CONF_ON_TTS_STREAM_END in config:
|
||||
await automation.build_automation(
|
||||
var.get_tts_stream_end_trigger(),
|
||||
[],
|
||||
config[CONF_ON_TTS_STREAM_END],
|
||||
)
|
||||
|
||||
cg.add_define("USE_VOICE_ASSISTANT")
|
||||
|
||||
|
||||
|
|
|
@ -632,11 +632,17 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
|
|||
case api::enums::VOICE_ASSISTANT_TTS_STREAM_START: {
|
||||
#ifdef USE_SPEAKER
|
||||
this->wait_for_stream_end_ = true;
|
||||
ESP_LOGD(TAG, "TTS stream start");
|
||||
this->tts_stream_start_trigger_->trigger();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case api::enums::VOICE_ASSISTANT_TTS_STREAM_END: {
|
||||
this->set_state_(State::RESPONSE_FINISHED, State::IDLE);
|
||||
#ifdef USE_SPEAKER
|
||||
ESP_LOGD(TAG, "TTS stream end");
|
||||
this->tts_stream_end_trigger_->trigger();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case api::enums::VOICE_ASSISTANT_STT_VAD_START:
|
||||
|
|
|
@ -107,6 +107,10 @@ class VoiceAssistant : public Component {
|
|||
Trigger<> *get_start_trigger() const { return this->start_trigger_; }
|
||||
Trigger<> *get_stt_vad_end_trigger() const { return this->stt_vad_end_trigger_; }
|
||||
Trigger<> *get_stt_vad_start_trigger() const { return this->stt_vad_start_trigger_; }
|
||||
#ifdef USE_SPEAKER
|
||||
Trigger<> *get_tts_stream_start_trigger() const { return this->tts_stream_start_trigger_; }
|
||||
Trigger<> *get_tts_stream_end_trigger() const { return this->tts_stream_end_trigger_; }
|
||||
#endif
|
||||
Trigger<> *get_wake_word_detected_trigger() const { return this->wake_word_detected_trigger_; }
|
||||
Trigger<std::string> *get_stt_end_trigger() const { return this->stt_end_trigger_; }
|
||||
Trigger<std::string> *get_tts_end_trigger() const { return this->tts_end_trigger_; }
|
||||
|
@ -135,6 +139,10 @@ class VoiceAssistant : public Component {
|
|||
Trigger<> *start_trigger_ = new Trigger<>();
|
||||
Trigger<> *stt_vad_start_trigger_ = new Trigger<>();
|
||||
Trigger<> *stt_vad_end_trigger_ = new Trigger<>();
|
||||
#ifdef USE_SPEAKER
|
||||
Trigger<> *tts_stream_start_trigger_ = new Trigger<>();
|
||||
Trigger<> *tts_stream_end_trigger_ = new Trigger<>();
|
||||
#endif
|
||||
Trigger<> *wake_word_detected_trigger_ = new Trigger<>();
|
||||
Trigger<std::string> *stt_end_trigger_ = new Trigger<std::string>();
|
||||
Trigger<std::string> *tts_end_trigger_ = new Trigger<std::string>();
|
||||
|
|
|
@ -674,6 +674,11 @@ void WiFiComponent::wifi_process_event_(IDFWiFiEvent *data) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (it.number == 0) {
|
||||
// no results
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t number = it.number;
|
||||
std::vector<wifi_ap_record_t> records(number);
|
||||
err = esp_wifi_scan_get_ap_records(&number, records.data());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2023.11.2"
|
||||
__version__ = "2023.11.3"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||
|
|
Loading…
Reference in a new issue