Support to ESPHome 2025.7.0
- Resolve duplicated names - Rebuilt HA event calls
This commit is contained in:
@@ -17,6 +17,8 @@ substitutions:
|
|||||||
|
|
||||||
<<: !include ../versioning/VERSION_YAML
|
<<: !include ../versioning/VERSION_YAML
|
||||||
|
|
||||||
|
EVENT_NAME: esphome.tx_ultimate_easy
|
||||||
|
|
||||||
TX_MODEL_FORMAT_EU_TEXT: "EU (Square, T5-xC-86)"
|
TX_MODEL_FORMAT_EU_TEXT: "EU (Square, T5-xC-86)"
|
||||||
TX_MODEL_FORMAT_US_TEXT: "US (Rectangle, T5-xC-120)"
|
TX_MODEL_FORMAT_US_TEXT: "US (Rectangle, T5-xC-120)"
|
||||||
|
|
||||||
@@ -116,13 +118,15 @@ script:
|
|||||||
parameters:
|
parameters:
|
||||||
type: string
|
type: string
|
||||||
then:
|
then:
|
||||||
- homeassistant.event:
|
- lambda: |-
|
||||||
event: esphome.tx_ultimate_easy
|
// Send event to Home Assistant
|
||||||
data:
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
device_name: !lambda return tx_device_name->state.c_str();
|
ha_event.fire_homeassistant_event("${EVENT_NAME}", {
|
||||||
firmware: ${version}
|
{"device_name", id(tx_device_name).state.c_str()},
|
||||||
domain: boot
|
{"firmware", "${version}"},
|
||||||
type: !lambda return type.c_str();
|
{"domain", "boot"},
|
||||||
|
{"type", type.c_str()}
|
||||||
|
});
|
||||||
|
|
||||||
- id: boot_done
|
- id: boot_done
|
||||||
mode: restart
|
mode: restart
|
||||||
|
|||||||
@@ -112,18 +112,19 @@ script:
|
|||||||
action: string
|
action: string
|
||||||
count: uint8_t
|
count: uint8_t
|
||||||
then:
|
then:
|
||||||
- homeassistant.event:
|
|
||||||
event: esphome.tx_ultimate_easy
|
|
||||||
data:
|
|
||||||
device_name: !lambda return tx_device_name->state.c_str();
|
|
||||||
firmware: ${version}
|
|
||||||
domain: touch
|
|
||||||
type: button
|
|
||||||
action: !lambda return action.c_str();
|
|
||||||
button_id: !lambda return button;
|
|
||||||
count: !lambda return count;
|
|
||||||
position: !lambda return id(button_press_position);
|
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
// Send event to Home Assistant
|
||||||
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
|
ha_event.fire_homeassistant_event("${EVENT_NAME}", {
|
||||||
|
{"device_name", id(tx_device_name).state.c_str()},
|
||||||
|
{"firmware", "${version}"},
|
||||||
|
{"domain", "touch"},
|
||||||
|
{"type", "button"},
|
||||||
|
{"action", action.c_str()},
|
||||||
|
{"button_id", to_string(button)},
|
||||||
|
{"count", to_string(count)},
|
||||||
|
{"position", to_string(id(button_press_position))}
|
||||||
|
});
|
||||||
ESP_LOGI("core_hw_buttons", "Button %" PRIu8 " action: '%s'", button, action.c_str());
|
ESP_LOGI("core_hw_buttons", "Button %" PRIu8 " action: '%s'", button, action.c_str());
|
||||||
if (action == "click") {
|
if (action == "click") {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ light:
|
|||||||
# Those lights are available based on the model selections
|
# Those lights are available based on the model selections
|
||||||
- &light_partition_with_effects
|
- &light_partition_with_effects
|
||||||
id: light_eu
|
id: light_eu
|
||||||
name: Light
|
name: Light EU
|
||||||
platform: partition
|
platform: partition
|
||||||
default_transition_length: ${default_transition_length}
|
default_transition_length: ${default_transition_length}
|
||||||
internal: true
|
internal: true
|
||||||
@@ -106,7 +106,7 @@ light:
|
|||||||
to: 27
|
to: 27
|
||||||
|
|
||||||
- id: light_us
|
- id: light_us
|
||||||
name: Light
|
name: Light US
|
||||||
<<: *light_partition_with_effects
|
<<: *light_partition_with_effects
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -115,7 +115,7 @@ light:
|
|||||||
|
|
||||||
- &light_partition_with_effects_disabled
|
- &light_partition_with_effects_disabled
|
||||||
id: light_eu_bottom
|
id: light_eu_bottom
|
||||||
name: Light - Bottom
|
name: Light - Bottom EU
|
||||||
disabled_by_default: true
|
disabled_by_default: true
|
||||||
<<: *light_partition_with_effects
|
<<: *light_partition_with_effects
|
||||||
segments:
|
segments:
|
||||||
@@ -124,7 +124,7 @@ light:
|
|||||||
to: 12
|
to: 12
|
||||||
reversed: true
|
reversed: true
|
||||||
- id: light_eu_left
|
- id: light_eu_left
|
||||||
name: Light - Left
|
name: Light - Left EU
|
||||||
<<: *light_partition_with_effects_disabled
|
<<: *light_partition_with_effects_disabled
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -132,7 +132,7 @@ light:
|
|||||||
to: 19
|
to: 19
|
||||||
reversed: true
|
reversed: true
|
||||||
- id: light_eu_right
|
- id: light_eu_right
|
||||||
name: Light - Right
|
name: Light - Right EU
|
||||||
<<: *light_partition_with_effects_disabled
|
<<: *light_partition_with_effects_disabled
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -144,7 +144,7 @@ light:
|
|||||||
to: 5
|
to: 5
|
||||||
reversed: false
|
reversed: false
|
||||||
- id: light_eu_top
|
- id: light_eu_top
|
||||||
name: Light - Top
|
name: Light - Top EU
|
||||||
<<: *light_partition_with_effects_disabled
|
<<: *light_partition_with_effects_disabled
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -152,7 +152,7 @@ light:
|
|||||||
to: 26
|
to: 26
|
||||||
reversed: false
|
reversed: false
|
||||||
- id: light_us_bottom
|
- id: light_us_bottom
|
||||||
name: Light - Bottom
|
name: Light - Bottom US
|
||||||
<<: *light_partition_with_effects_disabled
|
<<: *light_partition_with_effects_disabled
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -160,7 +160,7 @@ light:
|
|||||||
to: 14
|
to: 14
|
||||||
reversed: true
|
reversed: true
|
||||||
- id: light_us_left
|
- id: light_us_left
|
||||||
name: Light - Left
|
name: Light - Left US
|
||||||
<<: *light_partition_with_effects_disabled
|
<<: *light_partition_with_effects_disabled
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -168,7 +168,7 @@ light:
|
|||||||
to: 24
|
to: 24
|
||||||
reversed: true
|
reversed: true
|
||||||
- id: light_us_right
|
- id: light_us_right
|
||||||
name: Light - Right
|
name: Light - Right US
|
||||||
<<: *light_partition_with_effects_disabled
|
<<: *light_partition_with_effects_disabled
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -180,7 +180,7 @@ light:
|
|||||||
to: 8
|
to: 8
|
||||||
reversed: false
|
reversed: false
|
||||||
- id: light_us_top
|
- id: light_us_top
|
||||||
name: Light - Top
|
name: Light - Top US
|
||||||
<<: *light_partition_with_effects_disabled
|
<<: *light_partition_with_effects_disabled
|
||||||
segments:
|
segments:
|
||||||
- id: light_full
|
- id: light_full
|
||||||
@@ -567,7 +567,7 @@ select:
|
|||||||
# EU relay light mode template
|
# EU relay light mode template
|
||||||
- &relay_light_mode_eu
|
- &relay_light_mode_eu
|
||||||
id: sl_relay_1_light_mode_eu
|
id: sl_relay_1_light_mode_eu
|
||||||
name: Relay 1 light mode
|
name: Relay 1 light mode EU
|
||||||
platform: template
|
platform: template
|
||||||
options:
|
options:
|
||||||
- "${LIGHT_MODE_DISABLED_TEXT}"
|
- "${LIGHT_MODE_DISABLED_TEXT}"
|
||||||
@@ -582,19 +582,19 @@ select:
|
|||||||
disabled_by_default: false
|
disabled_by_default: false
|
||||||
icon: mdi:dots-square
|
icon: mdi:dots-square
|
||||||
- id: sl_relay_2_light_mode_eu
|
- id: sl_relay_2_light_mode_eu
|
||||||
name: Relay 2 light mode
|
name: Relay 2 light mode EU
|
||||||
<<: *relay_light_mode_eu
|
<<: *relay_light_mode_eu
|
||||||
- id: sl_relay_3_light_mode_eu
|
- id: sl_relay_3_light_mode_eu
|
||||||
name: Relay 3 light mode
|
name: Relay 3 light mode EU
|
||||||
<<: *relay_light_mode_eu
|
<<: *relay_light_mode_eu
|
||||||
- id: sl_relay_4_light_mode_eu
|
- id: sl_relay_4_light_mode_eu
|
||||||
name: Relay 4 light mode
|
name: Relay 4 light mode EU
|
||||||
<<: *relay_light_mode_eu
|
<<: *relay_light_mode_eu
|
||||||
|
|
||||||
# US relay light mode template
|
# US relay light mode template
|
||||||
- &relay_light_mode_us
|
- &relay_light_mode_us
|
||||||
id: sl_relay_1_light_mode_us
|
id: sl_relay_1_light_mode_us
|
||||||
name: Relay 1 light mode
|
name: Relay 1 light mode US
|
||||||
platform: template
|
platform: template
|
||||||
options:
|
options:
|
||||||
- "${LIGHT_MODE_DISABLED_TEXT}"
|
- "${LIGHT_MODE_DISABLED_TEXT}"
|
||||||
@@ -609,12 +609,12 @@ select:
|
|||||||
disabled_by_default: false
|
disabled_by_default: false
|
||||||
icon: mdi:dots-square
|
icon: mdi:dots-square
|
||||||
- id: sl_relay_2_light_mode_us
|
- id: sl_relay_2_light_mode_us
|
||||||
name: Relay 2 light mode
|
name: Relay 2 light mode US
|
||||||
<<: *relay_light_mode_us
|
<<: *relay_light_mode_us
|
||||||
- id: sl_relay_3_light_mode_us
|
- id: sl_relay_3_light_mode_us
|
||||||
name: Relay 3 light mode
|
name: Relay 3 light mode US
|
||||||
<<: *relay_light_mode_us
|
<<: *relay_light_mode_us
|
||||||
- id: sl_relay_4_light_mode_us
|
- id: sl_relay_4_light_mode_us
|
||||||
name: Relay 4 light mode
|
name: Relay 4 light mode US
|
||||||
<<: *relay_light_mode_us
|
<<: *relay_light_mode_us
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -386,69 +386,74 @@ tx_ultimate_easy:
|
|||||||
}
|
}
|
||||||
|
|
||||||
on_multi_touch_release:
|
on_multi_touch_release:
|
||||||
- homeassistant.event:
|
then:
|
||||||
event: esphome.tx_ultimate_easy
|
- lambda: |-
|
||||||
data:
|
// Send event to Home Assistant
|
||||||
device_name: !lambda return tx_device_name->state.c_str();
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
firmware: ${version}
|
ha_event.fire_homeassistant_event("${EVENT_NAME}", {
|
||||||
domain: touch
|
{"device_name", id(tx_device_name).state.c_str()},
|
||||||
type: multi_touch
|
{"firmware", "${version}"},
|
||||||
action: release
|
{"domain", "touch"},
|
||||||
position: !lambda return touch.x;
|
{"type", "multi_touch"},
|
||||||
- lambda: ESP_LOGI("core_hw_touch", "Multi-touch released");
|
{"action", "release"},
|
||||||
- script.execute: touch_on_multi_touch_release
|
{"position", to_string(touch.x)}
|
||||||
|
});
|
||||||
|
ESP_LOGI("core_hw_touch", "Multi-touch released");
|
||||||
|
touch_on_multi_touch_release->execute();
|
||||||
|
|
||||||
on_press:
|
on_press:
|
||||||
- lambda: |-
|
then:
|
||||||
const uint8_t position = static_cast<uint8_t>(touch.x);
|
- lambda: |-
|
||||||
if (position > ${TOUCH_POSITION_MAX_VALUE}) { // Check for valid range
|
const uint8_t position = static_cast<uint8_t>(touch.x);
|
||||||
ESP_LOGE("core_hw_touch", "Invalid touch position: %" PRIu8, position);
|
if (position > ${TOUCH_POSITION_MAX_VALUE}) { // Check for valid range
|
||||||
} else {
|
ESP_LOGE("core_hw_touch", "Invalid touch position: %" PRIu8, position);
|
||||||
ESP_LOGI("core_hw_touch", "Pressed at position %" PRIu8, position);
|
} else {
|
||||||
touch_on_press->execute(static_cast<uint8_t>(touch.button), position);
|
ESP_LOGI("core_hw_touch", "Pressed at position %" PRIu8, position);
|
||||||
}
|
touch_on_press->execute(static_cast<uint8_t>(touch.button), position);
|
||||||
|
}
|
||||||
|
|
||||||
on_release:
|
on_release:
|
||||||
- lambda: ESP_LOGI("core_hw_touch", "Released");
|
then:
|
||||||
- script.execute: touch_on_release
|
- lambda: ESP_LOGI("core_hw_touch", "Released");
|
||||||
|
- script.execute: touch_on_release
|
||||||
|
|
||||||
on_swipe_left:
|
on_swipe_left:
|
||||||
- homeassistant.event:
|
then:
|
||||||
event: esphome.tx_ultimate_easy
|
- lambda: |-
|
||||||
data:
|
std::string swipe_direction = (sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}") ? "left" : "down";
|
||||||
device_name: !lambda return tx_device_name->state.c_str();
|
// Send event to Home Assistant
|
||||||
firmware: ${version}
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
domain: touch
|
ha_event.fire_homeassistant_event("${EVENT_NAME}", {
|
||||||
type: swipe
|
{"device_name", id(tx_device_name).state.c_str()},
|
||||||
action: !lambda |-
|
{"firmware", "${version}"},
|
||||||
return sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}" ? "left" : "down";
|
{"domain", "touch"},
|
||||||
swipe-direction: !lambda |-
|
{"type", "swipe"},
|
||||||
return sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}" ? "left" : "down";
|
{"action", swipe_direction.c_str()},
|
||||||
position: !lambda return touch.x;
|
{"swipe-direction", swipe_direction.c_str()},
|
||||||
- lambda: |-
|
{"position", to_string(touch.x)}
|
||||||
ESP_LOGI("core_hw_touch", "Swipe %s", sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}"
|
});
|
||||||
? "left"
|
ESP_LOGI("core_hw_touch", "Multi-touch released");
|
||||||
: "down");
|
touch_on_multi_touch_release->execute();
|
||||||
- script.execute: touch_swipe_left
|
ESP_LOGI("core_hw_touch", "Swipe %s", swipe_direction.c_str());
|
||||||
|
touch_swipe_left->execute();
|
||||||
|
|
||||||
on_swipe_right:
|
on_swipe_right:
|
||||||
- homeassistant.event:
|
then:
|
||||||
event: esphome.tx_ultimate_easy
|
- lambda: |-
|
||||||
data:
|
std::string swipe_direction = (sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}") ? "right" : "up";
|
||||||
device_name: !lambda return tx_device_name->state.c_str();
|
// Send event to Home Assistant
|
||||||
firmware: ${version}
|
esphome::api::CustomAPIDevice ha_event;
|
||||||
domain: touch
|
ha_event.fire_homeassistant_event("${EVENT_NAME}", {
|
||||||
type: swipe
|
{"device_name", id(tx_device_name).state.c_str()},
|
||||||
action: !lambda |-
|
{"firmware", "${version}"},
|
||||||
return sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}" ? "right" : "up";
|
{"domain", "touch"},
|
||||||
swipe-direction: !lambda |-
|
{"type", "swipe"},
|
||||||
return sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}" ? "right" : "up";
|
{"action", swipe_direction.c_str()},
|
||||||
position: !lambda return touch.x;
|
{"swipe-direction", swipe_direction.c_str()},
|
||||||
- lambda: |-
|
{"position", to_string(touch.x)}
|
||||||
ESP_LOGI("core_hw_touch", "Swipe %s", sl_tx_model_format->state == "${TX_MODEL_FORMAT_EU_TEXT}"
|
});
|
||||||
? "right"
|
ESP_LOGI("core_hw_touch", "Swipe %s", swipe_direction.c_str());
|
||||||
: "up");
|
touch_swipe_right->execute();
|
||||||
- script.execute: touch_swipe_right
|
|
||||||
|
|
||||||
on_touch_event:
|
on_touch_event:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
|||||||
Reference in New Issue
Block a user