Set min_version to ESPHome 2025.8.0

This commit is contained in:
Edward Firmo
2025-08-08 07:37:52 +02:00
parent d905b69ad2
commit 1df58e162f
4 changed files with 35 additions and 17 deletions

View File

@@ -71,6 +71,7 @@ esphome:
name: ${name} name: ${name}
friendly_name: ${friendly_name} friendly_name: ${friendly_name}
comment: TX Ultimate Easy comment: TX Ultimate Easy
min_version: 2025.8.0-dev
project: project:
name: "edwardtfn.tx_ultimate_easy" name: "edwardtfn.tx_ultimate_easy"
version: ${version} version: ${version}

View File

@@ -29,8 +29,8 @@ substitutions:
LIGHT_SIDES_RESTORE_MODE: RESTORE_DEFAULT_OFF LIGHT_SIDES_RESTORE_MODE: RESTORE_DEFAULT_OFF
LIGHT_INDIVIDUAL_RESTORE_MODE: RESTORE_DEFAULT_OFF LIGHT_INDIVIDUAL_RESTORE_MODE: RESTORE_DEFAULT_OFF
LIGHT_ATTRS_DEFAULT: '0x64FFFFFF' # brightness=100, RGB=255,255,255 LIGHT_ATTRS_DEFAULT: '0x64FFFFFF' # brightness=100, RGB=255,255,255
LIGHT_DUAL_ATTRS_DEFAULT: '0x64FFFFFF64FFFFFF' # Both lights: brightness=100, RGB=255,255,255 LIGHT_DUAL_ATTRS_DEFAULT: '0x0064FFFFFF64FFFFFF' # Both lights: brightness=100, RGB=255,255,255
TAG_CORE_HW_LEDS: core.hw.leds TAG_CORE_HW_LEDS: core.hw.leds
@@ -562,6 +562,14 @@ script:
attr_global_ptr: uint32_t* attr_global_ptr: uint32_t*
then: then:
- lambda: |- - lambda: |-
if (!light_ptr) {
ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid light pointer");
return;
}
if (!attr_global_ptr) {
ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid attributes pointer");
return;
}
auto current = light_ptr->current_values; auto current = light_ptr->current_values;
tx_ultimate_easy::LightAttributes attrs = { tx_ultimate_easy::LightAttributes attrs = {
.brightness = uint8_t(current.get_brightness() * 100.0f), .brightness = uint8_t(current.get_brightness() * 100.0f),
@@ -582,6 +590,14 @@ script:
group_index: uint8_t # 1 or 2 (which group within the dual pack) group_index: uint8_t # 1 or 2 (which group within the dual pack)
then: then:
- lambda: |- - lambda: |-
if (!light_ptr) {
ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid light pointer");
return;
}
if (!attr_global_ptr) {
ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid attributes pointer");
return;
}
auto current = light_ptr->current_values; auto current = light_ptr->current_values;
tx_ultimate_easy::LightAttributes new_attrs = { tx_ultimate_easy::LightAttributes new_attrs = {
.brightness = uint8_t(current.get_brightness() * 100.0f), .brightness = uint8_t(current.get_brightness() * 100.0f),

View File

@@ -16,7 +16,12 @@ substitutions:
RELAY_MODE_TEXT_LIGHT: "Light" RELAY_MODE_TEXT_LIGHT: "Light"
RELAY_MODE_TEXT_NOT_USED: "Not in use" RELAY_MODE_TEXT_NOT_USED: "Not in use"
LIGHT_RELAYS_RESTORE_MODE: ALWAYS_OFF # You shouldn't change the restore mode as there is a custom restoring engine based on globals.
# The reason of a custom engine is to address an issue where NVS space was exceeded causing saving/restoring issues
RELAYS_LIGHT_RESTORE_MODE: ALWAYS_OFF
RELAYS_LIGHT_PARTITION_RESTORE_MODE: ALWAYS_OFF
RELAYS_EXPOSE_LEDS_TO_HA_RESTORE_MODE: ALWAYS_OFF
RELAYS_SWITCH_RESTORE_MODE: ALWAYS_OFF
TAG_STD_HW_RELAYS: std.hw.relays TAG_STD_HW_RELAYS: std.hw.relays
@@ -25,11 +30,6 @@ esphome:
build_flags: build_flags:
- -D TX_ULTIMATE_EASY_STANDARD_HW_RELAYS - -D TX_ULTIMATE_EASY_STANDARD_HW_RELAYS
external_components:
- source: github://pr#10105 # To-do: remove after this PR is released
components: [switch]
refresh: 1h
globals: globals:
- &global_attr_dual_light - &global_attr_dual_light
id: attr_light_rl_1_1_both # 1-gang: relay 1, both groups id: attr_light_rl_1_1_both # 1-gang: relay 1, both groups
@@ -113,7 +113,7 @@ light:
output: output_relay_1 output: output_relay_1
platform: binary platform: binary
internal: true internal: true
restore_mode: ${LIGHT_RELAYS_RESTORE_MODE} restore_mode: ${RELAYS_LIGHT_RESTORE_MODE}
on_turn_on: on_turn_on:
then: then:
- if: - if:
@@ -194,7 +194,7 @@ light:
internal: true internal: true
disabled_by_default: false disabled_by_default: false
default_transition_length: ${default_transition_length} default_transition_length: ${default_transition_length}
restore_mode: ALWAYS_OFF restore_mode: ${RELAYS_LIGHT_PARTITION_RESTORE_MODE}
segments: segments:
- id: light_full - id: light_full
from: 9 from: 9
@@ -1522,7 +1522,7 @@ switch:
- id: sw_expose_relays_leds_to_ha - id: sw_expose_relays_leds_to_ha
name: Expose Relay's LEDs to Home Assistant name: Expose Relay's LEDs to Home Assistant
platform: template platform: template
restore_mode: ALWAYS_OFF restore_mode: ${RELAYS_EXPOSE_LEDS_TO_HA_RESTORE_MODE}
optimistic: true optimistic: true
internal: false internal: false
entity_category: config entity_category: config
@@ -1545,7 +1545,7 @@ switch:
name: Relay 1 name: Relay 1
output: output_relay_1 output: output_relay_1
platform: output platform: output
restore_mode: ALWAYS_OFF restore_mode: ${RELAYS_SWITCH_RESTORE_MODE}
internal: true internal: true
on_turn_on: on_turn_on:
then: then:
@@ -1571,7 +1571,7 @@ switch:
name: Relay 2 name: Relay 2
output: output_relay_2 output: output_relay_2
platform: output platform: output
restore_mode: ALWAYS_OFF restore_mode: ${RELAYS_SWITCH_RESTORE_MODE}
internal: true internal: true
on_turn_on: on_turn_on:
then: then:
@@ -1597,7 +1597,7 @@ switch:
name: Relay 3 name: Relay 3
output: output_relay_3 output: output_relay_3
platform: output platform: output
restore_mode: ALWAYS_OFF restore_mode: ${RELAYS_SWITCH_RESTORE_MODE}
internal: true internal: true
on_turn_on: on_turn_on:
then: then:
@@ -1623,7 +1623,7 @@ switch:
name: Relay 4 name: Relay 4
output: output_relay_4 output: output_relay_4
platform: output platform: output
restore_mode: ALWAYS_OFF restore_mode: ${RELAYS_SWITCH_RESTORE_MODE}
internal: true internal: true
on_turn_on: on_turn_on:
then: then:

View File

@@ -74,8 +74,9 @@ namespace esphome {
if (this->gang_count_ == 1) if (this->gang_count_ == 1)
return 1; return 1;
// Calculate button number Change to round up instead of truncate (integer division) // Calculate button width (rounds up to ensure full coverage)
const uint8_t width = (TOUCH_MAX_POSITION + gang_count_) / this->gang_count_; // Width of each button region const uint8_t width =
(TOUCH_MAX_POSITION + this->gang_count_) / this->gang_count_; // Width of each button region
if (width < 1) // Invalid width - and prevents division by zero if (width < 1) // Invalid width - and prevents division by zero
return 0; return 0;
const uint8_t button = std::min( const uint8_t button = std::min(