194 lines
5.4 KiB
YAML
194 lines
5.4 KiB
YAML
####################################################################################################
|
|
##### TX Ultimate Easy for ESPHome #####
|
|
##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy #####
|
|
####################################################################################################
|
|
##### Purpose: ESPHome Core #####
|
|
####################################################################################################
|
|
##### 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:
|
|
name: tx-ultimate-easy
|
|
friendly_name: TX Ultimate Easy
|
|
|
|
<<: !include ../versioning/VERSION_YAML
|
|
|
|
TX_MODEL_FORMAT_EU_TEXT: "EU (Square, T5-xC-86)"
|
|
TX_MODEL_FORMAT_US_TEXT: "US (Rectangle, T5-xC-120)"
|
|
|
|
TX_MODEL_1_GANG_TEXT: "1 Gang"
|
|
TX_MODEL_2_GANG_TEXT: "2 Gang"
|
|
TX_MODEL_3_GANG_TEXT: "3 Gang"
|
|
TX_MODEL_4_GANG_TEXT: "4 Gang"
|
|
|
|
packages:
|
|
# yamllint disable rule:colons
|
|
core_api: !include TX-Ultimate-Easy-ESPHome_core_api.yaml
|
|
core_hw_buttons: !include TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml
|
|
core_hw_leds: !include TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml
|
|
core_hw_relays: !include TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml
|
|
core_hw_speaker: !include TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml
|
|
core_hw_touch: !include TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml
|
|
core_hw_vibration: !include TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml
|
|
# yamllint enable rule:colons
|
|
|
|
button:
|
|
- id: bt_restart
|
|
name: Restart
|
|
internal: false
|
|
platform: restart
|
|
|
|
captive_portal:
|
|
id: ap_captive_portal
|
|
|
|
esp32:
|
|
board: esp32dev
|
|
flash_size: 8MB
|
|
|
|
esphome:
|
|
name: ${name}
|
|
friendly_name: ${friendly_name}
|
|
comment: TX Ultimate Easy
|
|
platformio_options:
|
|
build_flags:
|
|
- -D TX_ULTIMATE_EASY_CORE
|
|
|
|
on_boot:
|
|
- priority: 700
|
|
then:
|
|
- script.execute: boot_initialize
|
|
|
|
- priority: 600 # This is where most sensors are set up.
|
|
then:
|
|
- script.execute: boot_sequence
|
|
|
|
- priority: -100 # At this priority, pretty much everything should already be initialized.
|
|
then:
|
|
- script.execute: boot_done
|
|
|
|
improv_serial:
|
|
id: serial_improv
|
|
|
|
logger:
|
|
level: INFO
|
|
|
|
ota:
|
|
platform: esphome
|
|
|
|
psram:
|
|
|
|
script:
|
|
- id: boot_done
|
|
mode: restart
|
|
then:
|
|
- script.execute:
|
|
id: send_event_to_ha
|
|
component: boot
|
|
event: done
|
|
|
|
- id: boot_initialize
|
|
mode: restart
|
|
then:
|
|
# Extended by:
|
|
# - HW Buttons
|
|
# - HW Relays
|
|
# - HW Touch
|
|
- script.execute:
|
|
id: send_event_to_ha
|
|
component: boot
|
|
event: start
|
|
|
|
- id: boot_sequence
|
|
mode: restart
|
|
then:
|
|
- script.execute: publish_device_info
|
|
|
|
- id: publish_device_info
|
|
mode: restart
|
|
then:
|
|
- lambda: |-
|
|
tx_fw_version->publish_state("${version}");
|
|
tx_device_name->publish_state(App.get_name().c_str());
|
|
|
|
select:
|
|
- id: sl_tx_model_format
|
|
name: Model (Format)
|
|
platform: template
|
|
options:
|
|
- "${TX_MODEL_FORMAT_EU_TEXT}"
|
|
- "${TX_MODEL_FORMAT_US_TEXT}"
|
|
initial_option: "${TX_MODEL_FORMAT_EU_TEXT}"
|
|
optimistic: true
|
|
restore_value: true
|
|
internal: false
|
|
entity_category: config
|
|
disabled_by_default: false
|
|
icon: mdi:tablet-cellphone
|
|
|
|
- id: sl_tx_model_gang
|
|
name: Model (Gang)
|
|
platform: template
|
|
options:
|
|
- "${TX_MODEL_1_GANG_TEXT}"
|
|
- "${TX_MODEL_2_GANG_TEXT}"
|
|
- "${TX_MODEL_3_GANG_TEXT}"
|
|
- "${TX_MODEL_4_GANG_TEXT}"
|
|
initial_option: "${TX_MODEL_1_GANG_TEXT}"
|
|
optimistic: true
|
|
restore_value: true
|
|
internal: false
|
|
entity_category: config
|
|
disabled_by_default: false
|
|
icon: mdi:dip-switch
|
|
|
|
text_sensor:
|
|
- id: tx_fw_version
|
|
name: Firmware version
|
|
platform: template
|
|
entity_category: diagnostic
|
|
icon: mdi:tag-text-outline
|
|
internal: false
|
|
update_interval: never
|
|
lambda: |-
|
|
return {"${version}"};
|
|
|
|
- id: tx_device_name
|
|
name: Device Name
|
|
platform: template
|
|
icon: mdi:identifier
|
|
entity_category: diagnostic
|
|
internal: false
|
|
disabled_by_default: false
|
|
update_interval: never
|
|
lambda: |-
|
|
return {"${name}"};
|
|
filters:
|
|
- lambda: |-
|
|
const std::string raw_name = x;
|
|
std::string result;
|
|
bool last_was_underscore = false;
|
|
for (const char& c : raw_name) {
|
|
if (isalnum(c)) {
|
|
result += tolower(c); // Add alphanumeric characters as lowercase
|
|
last_was_underscore = false;
|
|
} else if (!last_was_underscore) { // Replace non-alphanumeric with '_' but avoid consecutive '_'
|
|
result += '_';
|
|
last_was_underscore = true;
|
|
}
|
|
}
|
|
return result;
|
|
|
|
time:
|
|
- id: time_source
|
|
platform: homeassistant
|
|
|
|
web_server:
|
|
|
|
wifi:
|
|
ap:
|
|
...
|