diff --git a/esphome/m5stack-atom-echo.yaml b/esphome/m5stack-atom-echo.yaml index 469ed1e..08cf421 100644 --- a/esphome/m5stack-atom-echo.yaml +++ b/esphome/m5stack-atom-echo.yaml @@ -3,16 +3,16 @@ substitutions: name: m5stack-atom-echo friendly_name: M5Stack Atom Echo - micro_wake_word_model: okay_nabu # alexa, hey_jarvis, hey_mycroft are also supported esphome: name: ${name} - name_add_mac_suffix: False + name_add_mac_suffix: false friendly_name: ${friendly_name} - min_version: 2025.2.0 + min_version: 2025.5.0 esp32: board: m5stack-atom + cpu_frequency: 240MHz framework: type: esp-idf @@ -63,14 +63,17 @@ microphone: i2s_din_pin: GPIO23 adc_type: external pdm: true + sample_rate: 16000 + correct_dc_offset: true speaker: - platform: i2s_audio id: echo_speaker i2s_dout_pin: GPIO22 dac_type: external - bits_per_sample: 32bit - channel: right + bits_per_sample: 16bit + sample_rate: 16000 + channel: stereo # The Echo has poor playback audio quality when using mon audio buffer_duration: 60ms media_player: @@ -80,7 +83,6 @@ media_player: announcement_pipeline: speaker: echo_speaker format: WAV - codec_support_enabled: false buffer_size: 6000 volume_min: 0.4 files: @@ -91,14 +93,7 @@ media_player: condition: - microphone.is_capturing: then: - - if: - condition: - lambda: return id(wake_word_engine_location).state == "On device"; - then: - - micro_wake_word.stop: - else: - - voice_assistant.stop: - - script.execute: reset_led + - script.execute: stop_wake_word - light.turn_on: id: led blue: 100% @@ -108,14 +103,18 @@ media_player: effect: none on_idle: - script.execute: start_wake_word + - script.execute: reset_led voice_assistant: id: va - microphone: echo_microphone + micro_wake_word: + microphone: + microphone: echo_microphone + channels: 0 + gain_factor: 4 media_player: echo_media_player noise_suppression_level: 2 auto_gain: 31dBFS - volume_multiplier: 2.0 on_listening: - light.turn_on: id: led @@ -139,8 +138,26 @@ voice_assistant: brightness: 100% effect: none on_end: - - delay: 100ms - - script.execute: start_wake_word + # Handle the "nevermind" case where there is no announcement + - wait_until: + condition: + - media_player.is_announcing: + timeout: 0.5s + # Restart only mWW if enabled; streaming wake words automatically restart + - if: + condition: + - lambda: |- + return id(wake_word_engine_location).current_option() == "On device"; + then: + - wait_until: + - and: + - not: + voice_assistant.is_running: + - not: + speaker.is_playing: + - lambda: id(va).set_use_wake_word(false); + - micro_wake_word.start: + - script.execute: reset_led on_error: - light.turn_on: id: led @@ -155,11 +172,9 @@ voice_assistant: - delay: 2s # Give the api server time to settle - script.execute: start_wake_word on_client_disconnected: - - voice_assistant.stop: - - micro_wake_word.stop: + - script.execute: stop_wake_word on_timer_finished: - - voice_assistant.stop: - - micro_wake_word.stop: + - script.execute: stop_wake_word - wait_until: not: microphone.is_capturing: @@ -235,7 +250,8 @@ script: then: - if: condition: - - lambda: return id(wake_word_engine_location).state == "On device"; + - lambda: |- + return id(wake_word_engine_location).current_option() == "On device"; - switch.is_on: use_listen_light then: - light.turn_on: @@ -248,7 +264,8 @@ script: else: - if: condition: - - lambda: return id(wake_word_engine_location).state != "On device"; + - lambda: |- + return id(wake_word_engine_location).current_option() == "On device"; - switch.is_on: use_listen_light then: - light.turn_on: @@ -262,27 +279,41 @@ script: - light.turn_off: led - id: start_wake_word then: - - wait_until: - and: - - media_player.is_idle: - - speaker.is_stopped: - if: condition: - lambda: return id(wake_word_engine_location).state == "On device"; + and: + - not: + - voice_assistant.is_running: + - lambda: |- + return id(wake_word_engine_location).current_option() == "On device"; then: - - voice_assistant.stop - - micro_wake_word.stop: - - delay: 1s - - script.execute: reset_led - - script.wait: reset_led + - lambda: id(va).set_use_wake_word(false); - micro_wake_word.start: - else: - - if: - condition: voice_assistant.is_running - then: - - voice_assistant.stop: - - script.execute: reset_led + - if: + condition: + and: + - not: + - voice_assistant.is_running: + - lambda: |- + return id(wake_word_engine_location).current_option() == "In Home Assistant"; + then: + - lambda: id(va).set_use_wake_word(true); - voice_assistant.start_continuous: + - id: stop_wake_word + then: + - if: + condition: + lambda: |- + return id(wake_word_engine_location).current_option() == "In Home Assistant"; + then: + - lambda: id(va).set_use_wake_word(false); + - voice_assistant.stop: + - if: + condition: + lambda: |- + return id(wake_word_engine_location).current_option() == "On device"; + then: + - micro_wake_word.stop: switch: - platform: template @@ -342,7 +373,7 @@ select: condition: lambda: return x == "In Home Assistant"; then: - - micro_wake_word.stop + - micro_wake_word.stop: - delay: 500ms - lambda: id(va).set_use_wake_word(true); - voice_assistant.start_continuous: @@ -351,9 +382,9 @@ select: lambda: return x == "On device"; then: - lambda: id(va).set_use_wake_word(false); - - voice_assistant.stop + - voice_assistant.stop: - delay: 500ms - - micro_wake_word.start + - micro_wake_word.start: micro_wake_word: on_wake_word_detected: @@ -361,4 +392,9 @@ micro_wake_word: wake_word: !lambda return wake_word; vad: models: - - model: ${micro_wake_word_model} + - model: okay_nabu + id: okay_nabu + - model: hey_mycroft + id: hey_mycroft + - model: hey_jarvis + id: hey_jarvis diff --git a/esphome/riden-labornetzteil-18a.yaml b/esphome/riden-labornetzteil-18a.yaml index 8d207f7..587c6d1 100644 --- a/esphome/riden-labornetzteil-18a.yaml +++ b/esphome/riden-labornetzteil-18a.yaml @@ -1,3 +1,5 @@ +# Source: https://github.com/wildekek/rdtech-esphome + substitutions: name: "riden-labornetzteil-18a" friendly_name: "Riden Labornetzteil 18A" @@ -16,6 +18,8 @@ substitutions: RD6006_current_maximum: "6" RD6006_current_accuracy: "3" RD6006_current_multiplier: "0.001" + RD6006_power_accuracy: "2" + RD6006_power_multiplier: "0.01" RD6006P_voltage_maximum: "60" RD6006P_voltage_accuracy: "3" @@ -23,6 +27,8 @@ substitutions: RD6006P_current_maximum: "6" RD6006P_current_accuracy: "4" RD6006P_current_multiplier: "0.0001" + RD6006P_power_accuracy: "3" + RD6006P_power_multiplier: "0.001" RD6012_voltage_maximum: "60" RD6012_voltage_accuracy: "2" @@ -30,6 +36,8 @@ substitutions: RD6012_current_maximum: "12" RD6012_current_accuracy: "2" RD6012_current_multiplier: "0.01" + RD6012_power_accuracy: "2" + RD6012_power_multiplier: "0.01" RD6018_voltage_maximum: "60" RD6018_voltage_accuracy: "2" @@ -37,6 +45,8 @@ substitutions: RD6018_current_maximum: "18" RD6018_current_accuracy: "2" RD6018_current_multiplier: "0.01" + RD6018_power_accuracy: "2" + RD6018_power_multiplier: "0.01" esphome: name: $device_name @@ -45,7 +55,7 @@ esphome: name_add_mac_suffix: false project: name: "wildekek.rd6006-controller" - version: "1.4.1" + version: "1.5" esp8266: board: esp12e @@ -56,7 +66,7 @@ network: wifi: ssid: "Voltage-legacy" password: !secret voltage_legacy_psk - #use_address: riden-labornetzteil-18a.home + use_address: riden-labornetzteil-18a.home power_save_mode: high fast_connect: on min_auth_mode: WPA2 @@ -149,10 +159,10 @@ sensor: register_type: holding value_type: U_WORD accuracy_decimals: 0 - on_value: - then: - - lambda: |- - id(model_name).publish_state(value_accuracy_to_string(x, 0)); +# on_value: +# then: +# - lambda: |- +# id(model_name).publish_state(value_accuracy_to_string(x, 0)); - platform: modbus_controller name: "Serial Number" @@ -213,9 +223,9 @@ sensor: unit_of_measurement: "W" register_type: holding value_type: U_DWORD - accuracy_decimals: 2 + accuracy_decimals: ${${model}_power_accuracy} filters: - - multiply: 0.01 + - multiply: ${${model}_power_multiplier} - platform: modbus_controller modbus_controller_id: powersupply @@ -226,9 +236,9 @@ sensor: unit_of_measurement: "V" register_type: holding value_type: U_WORD - accuracy_decimals: ${${model}_voltage_accuracy} + accuracy_decimals: 2 filters: - - multiply: ${${model}_voltage_multiplier} + - multiply: 0.01 - platform: modbus_controller modbus_controller_id: powersupply @@ -266,9 +276,9 @@ sensor: unit_of_measurement: "V" register_type: holding value_type: U_WORD - accuracy_decimals: ${${model}_voltage_accuracy} + accuracy_decimals: 2 filters: - - multiply: ${${model}_voltage_multiplier} + - multiply: 0.01 - platform: modbus_controller name: "Temperature" diff --git a/esphome/riden-labornetzteil-6a.yaml b/esphome/riden-labornetzteil-6a.yaml index d0c30a5..a582180 100644 --- a/esphome/riden-labornetzteil-6a.yaml +++ b/esphome/riden-labornetzteil-6a.yaml @@ -1,3 +1,5 @@ +# Source: https://github.com/wildekek/rdtech-esphome + substitutions: name: "riden-labornetzteil-6a" friendly_name: "Riden Labornetzteil 6A" @@ -16,6 +18,8 @@ substitutions: RD6006_current_maximum: "6" RD6006_current_accuracy: "3" RD6006_current_multiplier: "0.001" + RD6006_power_accuracy: "2" + RD6006_power_multiplier: "0.01" RD6006P_voltage_maximum: "60" RD6006P_voltage_accuracy: "3" @@ -23,6 +27,8 @@ substitutions: RD6006P_current_maximum: "6" RD6006P_current_accuracy: "4" RD6006P_current_multiplier: "0.0001" + RD6006P_power_accuracy: "3" + RD6006P_power_multiplier: "0.001" RD6012_voltage_maximum: "60" RD6012_voltage_accuracy: "2" @@ -30,6 +36,8 @@ substitutions: RD6012_current_maximum: "12" RD6012_current_accuracy: "2" RD6012_current_multiplier: "0.01" + RD6012_power_accuracy: "2" + RD6012_power_multiplier: "0.01" RD6018_voltage_maximum: "60" RD6018_voltage_accuracy: "2" @@ -37,6 +45,8 @@ substitutions: RD6018_current_maximum: "18" RD6018_current_accuracy: "2" RD6018_current_multiplier: "0.01" + RD6018_power_accuracy: "2" + RD6018_power_multiplier: "0.01" esphome: name: $device_name @@ -56,7 +66,7 @@ network: wifi: ssid: "Voltage-legacy" password: !secret voltage_legacy_psk - #use_address: riden-labornetzteil-6a.home + use_address: riden-labornetzteil-6a.home power_save_mode: high fast_connect: on min_auth_mode: WPA2 @@ -149,10 +159,10 @@ sensor: register_type: holding value_type: U_WORD accuracy_decimals: 0 - on_value: - then: - - lambda: |- - id(model_name).publish_state(value_accuracy_to_string(x, 0)); +# on_value: +# then: +# - lambda: |- +# id(model_name).publish_state(value_accuracy_to_string(x, 0)); - platform: modbus_controller name: "Serial Number" @@ -213,9 +223,9 @@ sensor: unit_of_measurement: "W" register_type: holding value_type: U_DWORD - accuracy_decimals: 2 + accuracy_decimals: ${${model}_power_accuracy} filters: - - multiply: 0.01 + - multiply: ${${model}_power_multiplier} - platform: modbus_controller modbus_controller_id: powersupply @@ -226,9 +236,9 @@ sensor: unit_of_measurement: "V" register_type: holding value_type: U_WORD - accuracy_decimals: ${${model}_voltage_accuracy} + accuracy_decimals: 2 filters: - - multiply: ${${model}_voltage_multiplier} + - multiply: 0.01 - platform: modbus_controller modbus_controller_id: powersupply @@ -266,9 +276,9 @@ sensor: unit_of_measurement: "V" register_type: holding value_type: U_WORD - accuracy_decimals: ${${model}_voltage_accuracy} + accuracy_decimals: 2 filters: - - multiply: ${${model}_voltage_multiplier} + - multiply: 0.01 - platform: modbus_controller name: "Temperature"