Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1.54" LCD TOUCH CAPTIVE ST7789V
- # 400 mA Litium battery
- # Triaxial accelerometer BMA423
- # Touch Screen Chip: FT6236U
- # LoRa SX1262
- # PMU Power Management: AXP2101
- # Speaker: PIR
- # DRV2605 Haptic Motor SDA: IO10 SCL: IO11
- # RTC Clock Module: PCF8563
- ###############################
- # -> LILYGO-T-Watch-S3 <- #
- # -> ESPHOME <- #
- # -> https://github.com/velijv/LILYGO-T-Watch-S3-ESPHome <- #
- #############################
- substitutions:
- voice_assist_idle_phase_id: "1"
- voice_assist_listening_phase_id: "2"
- voice_assist_thinking_phase_id: "3"
- voice_assist_replying_phase_id: "4"
- voice_assist_not_ready_phase_id: "10"
- voice_assist_error_phase_id: "11"
- voice_assist_muted_phase_id: "12"
- esphome:
- name: watch
- platformio_options:
- board_build.flash_mode: dio
- on_boot:
- priority: 600
- then:
- - display.page.show: esphome_logo
- - delay: 30s
- - if:
- condition:
- lambda: return id(init_in_progress);
- then:
- - lambda: id(init_in_progress) = false
- esp32:
- board: esp32-s3-devkitc-1
- variant: esp32s3
- framework:
- type: arduino
- #type: esp-idf
- version: recommended
- # sdkconfig_options:
- # CONFIG_ESP32_S3_BOX_BOARD: "y"
- flash_size: 16MB
- psram:
- mode: octal
- speed: 80MHz
- logger:
- hardware_uart: uart0
- api:
- encryption:
- key: !secret api_key
- #Custom Creates a service to start listening
- services:
- - service: va_start
- then:
- - voice_assistant.start:
- silence_detection: true
- - service: va_stop
- then:
- - voice_assistant.stop
- # OTA is required for Over-the-Air updating
- ota:
- password: !secret api_key
- # password: "dd217a9ae48399a5252385c22f4db6a3"
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- ap:
- password: "12345678"
- image:
- - file: https://pungkula.duckdns.org:1337/local/duckie2.png
- id: esphome_logo
- resize: 240x240
- # Sets up the improv via serial client for Wi-Fi provisioning.
- # Handy if your device has a usb port for the user to add credentials when they first get it.
- improv_serial:
- next_url: https://veli.ee/esphome?device_name={{device_name}}&ip_address={{ip_address}}&esphome_version={{esphome_version}}
- #output:
- #- platform: ledc
- # pin: ?
- # id: backlight_output
- #light:
- # - platform: monochromatic
- # id: led
- # name: LCD Backlight
- # entity_category: config
- # output: backlight_output
- # restore_mode: RESTORE_DEFAULT_ON
- # default_transition_length: 250ms
- #remote_receiver:
- # pin: GPIO38
- # dump: all
- # Settings to optimize recognition of RF devices
- #tolerance: 50%
- #filter: 250us
- #idle: 4ms
- #buffer_size: 2kb
- #remote_transmitter:
- # pin: GPIO39
- # carrier_duty_percent: 100%
- # -> BUTTON <- #
- button:
- - platform: restart
- name: "Reboot Butler"
- entity_category: "diagnostic"
- - platform: shutdown
- name: "Stäng av Butler"
- entity_category: "diagnostic"
- - platform: factory_reset
- id: factory_reset_btn
- name: NOLLSTÄLL Butler
- # -> SPI <- #
- spi:
- clk_pin: GPIO18
- mosi_pin: GPIO13
- #miso_pin: NULL
- # -> i2C <- # - voice_assistant.start_continuous:
- i2c:
- # - id: bus_a
- # sda: GPIO18
- # scl: GPIO11
- # scan: true
- # #interrupt: GPIO14
- - id: tsc
- sda: GPIO39
- scl: GPIO48
- scan: true
- #interrupt: GPIO16
- # -> i2s audio <- #
- i2s_audio:
- id: i2saudio
- i2s_lrclk_pin: GPIO15
- #i2s_bclk_pin: GPIO18 #?
- #i2s_mclk_pin: 15
- #i2c_SDOUT: GPIO46
- # -> MICROPHONE <- #
- #microphone:
- # - platform: i2s_audio
- # bits_per_sample: 16bit
- # channel: right
- # i2s_din_pin: ${BOARD_MIC_DATA}
- # adc_type: external
- # pdm: true
- microphone:
- - platform: i2s_audio
- id: watch_mic
- bits_per_sample: 16bit
- channel: right
- i2s_din_pin: GPIO47
- adc_type: external
- pdm: true
- #SCLK PIN IO44
- # -> MEDIA PLAYER <- #
- media_player:
- - platform: i2s_audio
- id: watch_player
- i2s_dout_pin:
- number: GPIO46 # ${BOARD_DAC_IIS_DOUT}
- ignore_strapping_warning: true
- dac_type: external
- mode: mono
- i2s_comm_fmt: msb
- #########################
- # -> VOICE ASSISTANT <- #
- #########################
- voice_assistant:
- id: va
- microphone: watch_mic
- #speaker:
- media_player: watch_player
- use_wake_word: true
- noise_suppression_level: 0
- auto_gain: 31dBFS
- volume_multiplier: 2.0
- # vad_threshold: 3
- on_listening:
- - lambda: id(voice_assistant_phase) = ${voice_assist_listening_phase_id};
- on_stt_vad_end:
- - lambda: id(voice_assistant_phase) = ${voice_assist_thinking_phase_id};
- on_tts_end:
- - delay: 5s
- - homeassistant.service:
- service: media_player.play_media
- data:
- entity_id: media_player.ha
- media_content_id: !lambda 'return x;'
- media_content_type: music
- announce: "true"
- on_error:
- - if:
- condition:
- lambda: return !id(init_in_progress);
- then:
- - lambda: id(voice_assistant_phase) = ${voice_assist_error_phase_id};
- on_client_disconnected:
- - lambda: id(voice_assistant_phase) = ${voice_assist_not_ready_phase_id};
- ######################
- ######################
- # -> DISPLAY <- #
- display:
- # - platform: ili9xxx
- # - platform: ST7789V
- # cs_pin: GPIO12
- # dc_pin: GPIO38
- # id: screen
- # model: ST7789V
- # transform:
- # mirror_x: true
- # mirror_y: true
- # swap_xy: false
- # dimensions:
- # width: 240
- # height: 240
- # offset_width: 0
- # offset_height: 80
- # invert_colors: true
- - platform: ili9xxx
- cs_pin: GPIO12
- dc_pin: GPIO38
- id: screen
- model: ST7789V
- transform:
- mirror_x: true
- mirror_y: true
- swap_xy: false
- dimensions:
- width: 240
- height: 240
- offset_width: 0
- offset_height: 80
- invert_colors: true
- # -> TOUCHSCREEN <- #
- touchscreen:
- - platform: ft63x6
- interrupt_pin:
- number: GPIO16
- # allow_other_uses: true
- display: screen
- id: tscreen
- i2c_id: tsc
- calibration:
- x_min: 0
- x_max: 240
- y_min: 0
- y_max: 240
- on_touch:
- # - light.turn_on:
- # id: led
- # brightness: 50%
- # - voice_assistant.start:
- # silence_detection: true
- - if:
- condition: voice_assistant.is_running
- then:
- - voice_assistant.stop:
- else:
- - voice_assistant.start_continuous:
- ##### SWITCH ######
- switch:
- # - platform: template
- # name: Mute
- # id: mute
- # optimistic: true
- # restore_mode: RESTORE_DEFAULT_OFF
- # entity_category: config
- # on_turn_off:
- # - if:
- # condition:
- # lambda: return !id(init_in_progress);
- # then:
- # - lambda: id(va).set_use_wake_word(true);
- # - lambda: id(voice_assistant_phase) = id(voice_assist_idle_phase_id);
- # - if:
- # condition:
- # not:
- # - lambda: return id(voice_assistant).is_running();
- # then:
- # - lambda: id(voice_assistant).start_continuous();
- # on_turn_on:
- # - if:
- # condition:
- # lambda: return !id(init_in_progress);
- # then:
- # - lambda: id(voice_assistant).stop();
- - platform: template
- name: Use wake word
- id: use_wake_word
- optimistic: true
- restore_mode: RESTORE_DEFAULT_OFF
- 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);
- ##### SCRIPT #######
- #### GLOBALS ####
- globals:
- - id: init_in_progress
- type: bool
- restore_value: no
- initial_value: "true"
- - id: voice_assistant_phase
- type: int
- restore_value: no
- initial_value: ${voice_assist_not_ready_phase_id}
- color:
- - id: idle_color
- hex: ${idle_illustration_background_color}
- - id: listening_color
- hex: ${listening_illustration_background_color}
- - id: thinking_color
- hex: ${thinking_illustration_background_color}
- - id: replying_color
- hex: ${replying_illustration_background_color}
- - id: loading_color
- hex: ${loading_illustration_background_color}
- - id: error_color
- hex: ${error_illustration_background_color}
Advertisement
Add Comment
Please, Sign In to add comment