diff --git a/active/device_esphome/images/va_idle.png b/active/device_esphome/images/va_idle.png new file mode 100644 index 0000000..a078d63 Binary files /dev/null and b/active/device_esphome/images/va_idle.png differ diff --git a/active/device_esphome/images/va_idle.xcf b/active/device_esphome/images/va_idle.xcf new file mode 100644 index 0000000..b415a3b Binary files /dev/null and b/active/device_esphome/images/va_idle.xcf differ diff --git a/active/device_esphome/images/va_listen.png b/active/device_esphome/images/va_listen.png new file mode 100644 index 0000000..faef49a Binary files /dev/null and b/active/device_esphome/images/va_listen.png differ diff --git a/active/device_esphome/images/va_listen.xcf b/active/device_esphome/images/va_listen.xcf new file mode 100644 index 0000000..cdfbab7 Binary files /dev/null and b/active/device_esphome/images/va_listen.xcf differ diff --git a/active/device_esphome/images/va_speak.png b/active/device_esphome/images/va_speak.png new file mode 100644 index 0000000..3f314be Binary files /dev/null and b/active/device_esphome/images/va_speak.png differ diff --git a/active/device_esphome/images/va_speak.xcf b/active/device_esphome/images/va_speak.xcf new file mode 100644 index 0000000..1702012 Binary files /dev/null and b/active/device_esphome/images/va_speak.xcf differ diff --git a/active/device_esphome/tab5.yaml b/active/device_esphome/tab5.yaml index 34ad436..3b63ded 100644 --- a/active/device_esphome/tab5.yaml +++ b/active/device_esphome/tab5.yaml @@ -43,6 +43,17 @@ ota: wifi: ssid: !secret wifi_ssid password: !secret wifi_password + on_connect: + - lvgl.label.update: + id: lbl_status + text: "IDLE" + - select.set: + id: dac_output + option: "LINE1" + on_disconnect: + - lvgl.label.update: + id: lbl_status + text: "DISCONNECTED" i2c: - id: bsp_bus @@ -103,6 +114,7 @@ switch: pin: pi4ioe5v6408: pi4ioe2 number: 7 + restore_mode: ALWAYS_ON - platform: gpio id: wifi_antenna_int_ext pin: @@ -159,8 +171,8 @@ sensor: lambda: |- float voltage = id(battery_voltage).state; // Adjust these values based on your battery's actual min/max voltage - float min_voltage = 6.0; // Discharged voltage - float max_voltage = 8.23; // Fully charged voltage + float min_voltage = 6.75; // Discharged voltage + float max_voltage = 8.2; // Fully charged voltage float percentage = (voltage - min_voltage) / (max_voltage - min_voltage) * 100.0; if (percentage > 100.0) return 100.0; if (percentage < 0.0) return 0.0; @@ -168,6 +180,14 @@ sensor: update_interval: 60s unit_of_measurement: "%" accuracy_decimals: 1 + id: battery_percent + on_value: + then: + - lvgl.label.update: + id: lbl_battery + text: + format: "Battery: %.1f%" + args: ["id(battery_percent).state"] touchscreen: - platform: st7123 @@ -221,16 +241,26 @@ light: default_transition_length: 250ms initial_state: brightness: "100%" - - platform: lvgl - widget: listen_led_widget - name: LVGL light - id: listen_led + +image: + defaults: + type: rgb565 + transparency: alpha_channel + resize: 512x512 + byte_order: little_endian + images: + - file: "images/va_idle.png" + id: va_idle + - file: "images/va_listen.png" + id: va_listen + - file: "images/va_speak.png" + id: va_speak lvgl: byte_order: little_endian on_idle: - timeout: 60s + timeout: 120s then: - logger.log: "LVGL is idle" - light.turn_off: @@ -238,31 +268,35 @@ lvgl: transition_length: 15s - lvgl.pause: widgets: - - led: - id: listen_led_widget + - image: + id: listen_icon_widget + src: va_idle align: CENTER - color: 0xFF0000 - brightness: 0% - height: 100px - width: 100px - label: align: TOP_MID id: lbl_status text_font: montserrat_48 - text: "IDLE" + text: "CONNECTING..." - label: align: BOTTOM_LEFT id: lbl_version text_font: montserrat_12 - text: "v0.1" + text: "v0.5" + - label: + align: BOTTOM_RIGHT + id: lbl_battery + text_font: montserrat_28 + text: Loading... # The DAC Output select needs to be manually (or with an automation) changed to `LINE1` for the onboard speaker select: - platform: es8388 dac_output: name: DAC Output + id: dac_output adc_input_mic: name: ADC Input Mic + id: adc_input - platform: template id: wifi_antenna_select @@ -339,44 +373,29 @@ voice_assistant: media_player: tab5_media_player micro_wake_word: mww on_listening: - - if: - condition: lvgl.is_paused - then: - - logger.log: "LVGL resuming" - - lvgl.resume: - - light.turn_on: backlight - - light.turn_on: - id: listen_led - brightness: 100% - red: 0% - green: 100% - blue: 0% - effect: "None`" + - logger.log: "LVGL resuming" + - lvgl.resume: + - light.turn_on: backlight + - lvgl.image.update: + id: listen_icon_widget + src: va_listen - lvgl.label.update: id: lbl_status text: "LISTENING" on_stt_vad_end: - - light.turn_on: - id: listen_led - brightness: 100% - red: 0% - green: 0% - blue: 100% - effect: "None" - lvgl.label.update: id: lbl_status text: "PROCESSING" + - lvgl.image.update: + id: listen_icon_widget + src: va_idle on_tts_start: - - light.turn_on: - id: listen_led - brightness: 100% - red: 100% - green: 0% - blue: 0% - effect: "None" - lvgl.label.update: id: lbl_status text: "RESPONDING" + - lvgl.image.update: + id: listen_icon_widget + src: va_speak on_end: # Wait a short amount of time to see if an announcement starts - wait_until: @@ -391,13 +410,12 @@ voice_assistant: - not: speaker.is_playing: - micro_wake_word.start: - - lvgl.led.update: - id: listen_led_widget - color: 0x000000 - brightness: "0%" - lvgl.label.update: id: lbl_status text: "IDLE" + - lvgl.image.update: + id: listen_icon_widget + src: va_idle - light.turn_off: id: backlight transition_length: 15s