108 lines
3.7 KiB
YAML
108 lines
3.7 KiB
YAML
####################################################################################################
|
|
##### TX Ultimate Easy for ESPHome #####
|
|
##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy #####
|
|
####################################################################################################
|
|
##### Purpose: ESPHome Core - Add-on - BLE Proxy #####
|
|
####################################################################################################
|
|
##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo #####
|
|
####################################################################################################
|
|
##### NOTE: #####
|
|
##### - Make changes ONLY if absolutely necessary and you have the required knowledge. #####
|
|
##### - For normal system use, modifications to this file are NOT required. #####
|
|
####################################################################################################
|
|
---
|
|
substitutions:
|
|
# RTTTL format: name:d=duration,o=octave,b=tempo:notes
|
|
# d=32 (32nd note), o=5 (octave 5), b=100 (tempo 100)
|
|
tone_volume_change: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" # Use "none" to disable sound
|
|
|
|
api:
|
|
actions:
|
|
- action: rtttl_play
|
|
variables:
|
|
# The RTTTL string for the melody to be played.
|
|
# It should follow the RTTTL format, including the melody's name,
|
|
# default settings, and a sequence of notes.
|
|
tone: string
|
|
then:
|
|
- lambda: |-
|
|
rtttl_speaker->stop();
|
|
if (rtttl_speaker_gain->state > 0) {
|
|
ESP_LOGI("api", "Play tone: '%s'", tone.c_str());
|
|
rtttl_speaker->play(tone.c_str());
|
|
}
|
|
|
|
bluetooth_proxy:
|
|
|
|
esp32:
|
|
framework:
|
|
type: esp-idf
|
|
sdkconfig_options:
|
|
CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST: "y"
|
|
CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY: "y"
|
|
CONFIG_ESP32_REV_MIN_3: "y"
|
|
CONFIG_MBEDTLS_DYNAMIC_BUFFER: "y"
|
|
CONFIG_MBEDTLS_DYNAMIC_FREE_CA_CERT: "y"
|
|
CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA: "y"
|
|
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC: "y"
|
|
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY: "y"
|
|
CONFIG_SPIRAM_RODATA: "y"
|
|
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP: "y"
|
|
|
|
esphome:
|
|
platformio_options:
|
|
build_flags:
|
|
- -D TX_ULTIMATE_EASY_ADDON_BLE_PROXY
|
|
|
|
light:
|
|
- id: !extend light_full
|
|
platform: esp32_rmt_led_strip
|
|
rgb_order: GRB
|
|
rmt_channel: 1
|
|
chipset: ws2812
|
|
type: !remove
|
|
variant: !remove
|
|
max_refresh_rate: 33ms
|
|
use_psram: true
|
|
|
|
media_player: !remove
|
|
|
|
number:
|
|
- id: rtttl_speaker_gain
|
|
name: Sound - Volume
|
|
platform: template
|
|
max_value: 100
|
|
min_value: 0
|
|
step: 1
|
|
initial_value: 100
|
|
unit_of_measurement: "%"
|
|
internal: false
|
|
disabled_by_default: true
|
|
entity_category: config
|
|
device_class: sound_pressure
|
|
restore_value: true
|
|
optimistic: true
|
|
set_action:
|
|
then:
|
|
- lambda: |-
|
|
rtttl_speaker->set_gain((100-(x/10.0f))/100.0f);
|
|
std::string tone_volume_change = "${tone_volume_change}";
|
|
// Play sound if tone_volume_change is not "none"
|
|
if (x > 0 and !tone_volume_change.empty() and tone_volume_change != "none")
|
|
rtttl_speaker->play(tone_volume_change);
|
|
rtttl_speaker->dump_config();
|
|
|
|
rtttl:
|
|
- id: rtttl_speaker
|
|
speaker: mp_speaker
|
|
|
|
speaker:
|
|
- id: mp_speaker
|
|
platform: i2s_audio
|
|
dac_type: external
|
|
i2s_dout_pin: GPIO15
|
|
i2s_audio_id: if_i2s_audio
|
|
i2s_comm_fmt: stand_msb
|
|
channel: mono
|
|
...
|