Import YAML files into repository

This commit is contained in:
2026-01-20 23:08:05 -07:00
parent af94e08fe4
commit 3239e56c8d
31 changed files with 1550 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
esphome:
includes:
- "<lwip/apps/mdns_priv.h>" # for struct mdns_service, struct mdns_txtdata
- "<lwip/init.h>" # for LWIP_VERSION_STRING
bk72xx:
framework:
loglevel: debug
debug:
- mdns
- lwip
sdk_silent: auto
text_sensor:
- platform: libretiny
version:
id: libretiny_version_id
name: LibreTiny Version
- platform: template
name: "LWIP_VERSION_STRING"
entity_category: diagnostic
lambda: |-
static const std::string s = LWIP_VERSION_STRING;
return s;
sensor:
- platform: template
name: "MDNS_TXT_RDATA_SIZE"
accuracy_decimals: 0
entity_category: diagnostic
lambda: |-
#ifdef MDNS_TXT_RDATA_SIZE
return MDNS_TXT_RDATA_SIZE;
#else
return {};
#endif
- platform: template
name: "size of mdns_service.txtdata"
accuracy_decimals: 0
entity_category: diagnostic
lambda: |-
struct mdns_service srv;
return sizeof(srv.txtdata);
- platform: template
name: "size of mdns_txtdata.rdata"
accuracy_decimals: 0
entity_category: diagnostic
lambda: |-
struct mdns_txtdata txt;
return sizeof(txt.rdata);

View File

@@ -0,0 +1,7 @@
packages:
- !include libretiny-mdns-fix.yaml
bk72xx:
framework:
options:
MDNS_TXT_RDATA_SIZE: 384 # https://github.com/esphome/esphome/issues/11281

View File

@@ -0,0 +1,4 @@
sensor:
- platform: internal_temperature
id: cpu_temperature
name: "CPU Temperature"

View File

@@ -0,0 +1,19 @@
# Common options for the ESP-Shelly-C38F SoC
packages:
- !include esp32c3.yaml
esphome:
platformio_options:
board_build.flash_mode: dio
esp32:
variant: esp32c3
# cpu_frequency: 240MHz
flash_size: 8MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_MBEDTLS_SSL_PROTO_TLS1_3: "y" # TLS1.3 support still isn't enabled by default in IDF 5.5.2
# CONFIG_MBEDTLS_DEFAULT_CERTIFICATE_BUNDLE: CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN
# CONFIG_LWIP_NETIF_LOOPBACK: "n" # Apparently there's a bug causing the ICMPv6 Router Solicitation to go out over the loopback interface rather than wifi

25
common/esp32-u4wdh.yaml Normal file
View File

@@ -0,0 +1,25 @@
# Common options for the ESP32-U4WDH SoC
# CPU: ESP32-U4WDH (revision v3.1)
# Features: Wi-Fi, BT, Dual Core + LP Core, 240MHz, Embedded Flash, Vref calibration in eFuse, Coding Scheme None
# Crystal frequency: 40MHz
# Memory: 320KB RAM, 4MB Flash
packages:
- !include esp32.yaml
esphome:
platformio_options:
board_build.flash_mode: dio
esp32:
variant: esp32
# cpu_frequency: 240MHz
flash_size: 4MB
framework:
type: esp-idf
# advanced:
# minimum_chip_revision: "3.1" # Requires ESPHome 2026.1.0 ?
sdkconfig_options:
CONFIG_MBEDTLS_SSL_PROTO_TLS1_3: "y" # TLS1.3 support still isn't enabled by default in IDF 5.5.2
CONFIG_MBEDTLS_DEFAULT_CERTIFICATE_BUNDLE: CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN
# CONFIG_LWIP_NETIF_LOOPBACK: "n" # Apparently there's a bug causing the ICMPv6 Router Solicitation to go out over the loopback interface rather than wifi

17
common/esp32.yaml Normal file
View File

@@ -0,0 +1,17 @@
esp32:
variant: esp32
framework:
type: esp-idf
sdkconfig_options:
CONFIG_MBEDTLS_SSL_PROTO_TLS1_3: "y" # TLS1.3 support still isn't enabled by default in IDF 5.5.2
# CONFIG_LWIP_NETIF_LOOPBACK: "n" # Apparently there's a bug causing the ICMPv6 Router Solicitation to go out over the loopback interface rather than wifi
# -- begin copied from https://github.com/athom-tech/esp32-configs --
# @grigi found in testing that these options resulted in better responsiveness.
# BLE 4.2 is supported by ALL ESP32 boards that have bluetooth, the original and derivatives.
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
# Also enable this on any derivative boards (S2, C3 etc) but not the original ESP32.
# CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
# Extend the watchdog timeout, so the device reboots if the device appears locked up for over 10 seconds.
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
# -- end copied from https://github.com/athom-tech/esp32-configs --

17
common/esp32c3.yaml Normal file
View File

@@ -0,0 +1,17 @@
esp32:
variant: esp32c3
framework:
type: esp-idf
sdkconfig_options:
CONFIG_MBEDTLS_SSL_PROTO_TLS1_3: "y" # TLS1.3 support still isn't enabled by default in IDF 5.5.2
# CONFIG_LWIP_NETIF_LOOPBACK: "n" # Apparently there's a bug causing the ICMPv6 Router Solicitation to go out over the loopback interface rather than wifi
# -- begin copied from https://github.com/athom-tech/esp32-configs --
# @grigi found in testing that these options resulted in better responsiveness.
# BLE 4.2 is supported by ALL ESP32 boards that have bluetooth, the original and derivatives.
# CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
# Also enable this on any derivative boards (S2, C3 etc) but not the original ESP32.
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
# Extend the watchdog timeout, so the device reboots if the device appears locked up for over 10 seconds.
# CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
# -- end copied from https://github.com/athom-tech/esp32-configs --

13
common/factory-reset.yaml Normal file
View File

@@ -0,0 +1,13 @@
factory_reset:
resets_required: 10
max_delay: 10s
on_increment:
- logger.log:
format: "(factory_reset) Fast power cycle count now %u, target %u"
args: [x, target]
button:
- platform: factory_reset
id: button_factory_reset
name: Factory reset
disabled_by_default: true

View File

@@ -0,0 +1,2 @@
preferences:
flash_write_interval: 5min

View File

@@ -0,0 +1,4 @@
esphome:
platformio_options:
platform_packages:
- "library-lwip @ https://github.com/dlitz/lwip.git#mdns-big-txt_bdk"

View File

@@ -0,0 +1,35 @@
substitutions:
ota_password: !secret fallback_ota_password
ota_new_password: ""
ota_update_password: 0
esphome:
on_boot:
- lambda: |-
#define OTA_UPDATE_PASSWORD ${ota_update_password}
#if !(OTA_UPDATE_PASSWORD == 0 || OTA_UPDATE_PASSWORD == 1)
# error ota_update_password must be 0 or 1
#endif
#ifdef USE_OTA_PASSWORD
const bool ota_update_password = bool(OTA_UPDATE_PASSWORD);
const std::string ota_new_password = "${ota_new_password}";
if (ota_update_password) {
if (ota_new_password.empty()) {
ESP_LOGI("ota_update_password", "Setting blank OTA password");
} else {
ESP_LOGI("ota_update_password", "Setting new OTA password");
}
id(ota_id).set_auth_password(ota_new_password);
} else {
ESP_LOGI("ota_update_password", "No new OTA password");
}
#elif OTA_UPDATE_PASSWORD == 1
# error Cannot set new OTA password - not compiled with OTA support (hint: set a dummy ota_password)
#else
# warning No OTA password set.
#endif
ota:
- id: !extend ota_id
platform: esphome
password: "${ota_password or ota_new_password}"

7
common/ota.yaml Normal file
View File

@@ -0,0 +1,7 @@
substitutions:
ota_password: !secret fallback_ota_password
ota:
- platform: esphome
id: ota_id
password: "${ota_password}"

4
common/restart.yaml Normal file
View File

@@ -0,0 +1,4 @@
button:
- platform: restart
id: button_restart
name: Restart

7
common/safe-mode.yaml Normal file
View File

@@ -0,0 +1,7 @@
safe_mode:
reboot_timeout: 10min
button:
- platform: safe_mode
id: button_safe_mode
name: Safe Mode Boot

42
common/shelly-button.yaml Normal file
View File

@@ -0,0 +1,42 @@
substitutions:
# shelly_button_gpio_number: GPIO1
shelly_button_gpio_pin:
number: ${shelly_button_gpio_number}
mode:
input: true
pullup: true
inverted: true
shelly_button_default_action: []
shelly_button_longpress_action: []
# Separate _internal substitutions so that assigning to the above replaces
# (rather than appends to) the default action.
_shelly_button_default_action_internal:
- button.press: button_safe_mode
_shelly_button_longpress_action_internal:
- button.press: button_factory_reset
binary_sensor:
- platform: gpio
id: shelly_button_id
name: "Button"
entity_category: diagnostic
pin: ${shelly_button_gpio_pin}
filters:
- settle: 10ms
on_multi_click:
- timing:
- ON for at least 5s
then:
- logger.log: "Button held for 5s"
- timing:
- ON for at least 10s
then:
- logger.log: "Button held for 10s"
- timing:
- ON for 5s to 10s
- OFF for at least 100ms
then: ${shelly_button_default_action or _shelly_button_default_action_internal}
- timing:
- ON for at least 10s
- OFF for at least 100ms
then: ${shelly_button_longpress_action or _shelly_button_longpress_action_internal}

View File

@@ -0,0 +1,16 @@
substitutions:
# shelly_header_gpio_number: GPIO19
shelly_header_gpio_pin:
number: ${shelly_header_gpio_number}
inverted: true
mode:
input: true
pullup: true
binary_sensor:
- platform: gpio
id: binary_sensor_header_gpio_id
name: "Header GPIO"
entity_category: diagnostic
disabled_by_default: true
pin: ${shelly_header_gpio_pin}

View File

@@ -0,0 +1,26 @@
substitutions:
# shelly_ntc_temperature_pin: GPIO3
sensor:
- platform: ntc
id: ntc_temperature
name: "NTC Temperature"
entity_category: diagnostic
unit_of_measurement: "°C"
accuracy_decimals: 1
icon: "mdi:thermometer"
sensor: temp_resistance_reading
calibration:
b_constant: 3350
reference_resistance: 10kOhm
reference_temperature: 298.15K
- platform: resistance
id: temp_resistance_reading
sensor: temp_analog_reading
configuration: DOWNSTREAM
resistor: 10kOhm
- platform: adc
id: temp_analog_reading
pin: ${shelly_ntc_temperature_pin}
attenuation: 12db

11
common/time.yaml Normal file
View File

@@ -0,0 +1,11 @@
time:
- platform: homeassistant
id: homeassistant_time
# on_time_sync:
# - logger.log: "HA time synchronized!"
- platform: sntp
id: sntp_time
# on_time_sync:
# - logger.log: "SNTP time synchronized!"

16
common/uptime-info.yaml Normal file
View File

@@ -0,0 +1,16 @@
# Requires time.yaml
sensor:
- platform: uptime
id: uptime_seconds
type: seconds
name: Uptime
disabled_by_default: true
- platform: uptime
id: uptime_timestamp
type: timestamp
name: Last Boot
# FIXME: Fix the uptime component so that it can use any configured time
# source, rather than just the first one.
time_id: sntp_time

42
common/wifi-info.yaml Normal file
View File

@@ -0,0 +1,42 @@
sensor:
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
- platform: copy # Reports the WiFi signal strength in %
id: wifi_signal_percent
source_id: wifi_signal_db
name: "WiFi Signal Percent"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: diagnostic
device_class: ""
text_sensor:
- platform: wifi_info
ip_address:
name: Device IP Address
address_0:
name: Device IP Address 0
address_1:
name: Device IP Address 1
address_2:
name: Device IP Address 2
# address_3:
# name: Device IP Address 3
# address_4:
# name: Device IP Address 4
ssid:
name: Device Connected SSID
bssid:
name: Device Connected BSSID
mac_address:
name: Device MAC Address
# scan_results:
# name: Device Latest Scan Results
# dns_address:
# name: Device DNS Address
# power_save_mode:
# name: Device Wifi Power Save Mode