Skip to content

Move HA event handling to component#135

Merged
edwardtfn merged 25 commits intomainfrom
code-update
Dec 9, 2025
Merged

Move HA event handling to component#135
edwardtfn merged 25 commits intomainfrom
code-update

Conversation

@edwardtfn
Copy link
Owner

@edwardtfn edwardtfn commented Nov 27, 2025

Summary by CodeRabbit

  • New Features

    • Centralized API to emit Home Assistant events for touch, swipe, button and other hardware interactions.
    • Device name cache initialized on Wi‑Fi connect; firmware version published.
    • Public text sensor and device name now sourced from the cached device name.
  • Chores

    • Version bumped to 9999.99.9.
    • Standardized logging tags, package keys and build flags across components and configs.
    • API now enables Home Assistant services.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Warning

Rate limit exceeded

@edwardtfn has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5dddc7b and 2ec6053.

📒 Files selected for processing (1)
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (1 hunks)

Walkthrough

Adds a new tx_ultimate_easy C++ API and cached device-name for emitting enriched Home Assistant events; replaces YAML homeassistant.event usages with the new API for touch/button flows; renames many logging tags, build flags, and preprocessor guards across YAML and C++ files; bumps project version to 9999.99.9.

Changes

Cohort / File(s) Summary
New API & cache
components/tx_ultimate_easy/tx_ultimate_easy_api.cpp, components/tx_ultimate_easy/tx_ultimate_easy_api.h
Adds esphome::tx_ultimate_easy::cached_device_name and initialize_cached_device_name(raw_name); adds feed_wdt_delay(ms) inline helper; introduces fire_ha_event(domain,type,data) which enriches payload (device_name, firmware, domain, type), logs, creates a CustomAPIDevice and calls fire_homeassistant_event.
Common YAML & device-name publishing
ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
Renames TAG_CORE_COMMONTAG_COMMON; enables api.homeassistant_services; adds wifi.on_connect logic and update_device_name script to initialize/publish esphome::tx_ultimate_easy::cached_device_name; adds build-flag for firmware version; text_sensor and logs now source cached name.
Package/key remapping
ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml, ESPHome/TX-Ultimate-Easy-ESPHome_standard.yaml, TX-Ultimate-Easy-ESPHome_advanced.yaml
Renames package keys/includes (e.g., core_commoncommon, core_hw_*hw_*, standard_*hw_*, media_player mapping) and updates include paths.
Hardware tag & build-flag renames
multiple ESPHome/*.yaml (hw_audio, hw_buttons, hw_leds, hw_relays, hw_speaker, hw_touch, hw_vibration, media_player, standard → hw mappings)
Standardizes logging tags (TAG_STD_*/TAG_CORE_*TAG_HW_*/TAG_*), updates PlatformIO build flags and guard macros (TX_ULTIMATE_EASY_CORE_*/TX_ULTIMATE_EASY_STANDARD_*TX_ULTIMATE_EASY_*), and updates error messages and log strings.
Touch/button event emission changes
ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml, ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
Replaces YAML homeassistant.event blocks with esphome::tx_ultimate_easy::fire_ha_event(...) calls, adjusting payloads (multi-touch, swipe, button) and logs to use cached device name and firmware.
C++: preprocessor guard updates
components/tx_ultimate_easy/tx_ultimate_easy_light.cpp, components/tx_ultimate_easy/tx_ultimate_easy_light.h, components/tx_ultimate_easy/tx_ultimate_easy_touch.cpp, components/tx_ultimate_easy/tx_ultimate_easy_touch.h
Replace compile guards from TX_ULTIMATE_EASY_CORE_HW_*TX_ULTIMATE_EASY_HW_* (no functional changes).
Tests / demo YAML package key updates
.test/.../*.yaml (.test/esphome_ard_hw_relays.yaml, .test/esphome_ard_hw_speaker.yaml, .test/esphome_ard_hw_vibration.yaml, .test/esphome_idf_hw_relays.yaml, .test/esphome_idf_hw_speaker.yaml, .test/esphome_idf_hw_vibration.yaml)
Rename package keys from standard_*hw_* and update include paths to new YAML filenames.
Versioning
versioning/VERSION, versioning/VERSION_YAML
Bumps project version string from 2025.10.19999.99.9.

Sequence Diagram(s)

sequenceDiagram
    participant YAML as Device YAML (touch/button)
    participant API as tx_ultimate_easy::fire_ha_event
    participant ESPAPI as esphome::api::CustomAPIDevice
    participant HA as Home Assistant

    YAML->>API: call fire_ha_event(domain,type,data)
    Note right of API: normalize/augment payload with cached_device_name, firmware, domain, type
    API->>ESPAPI: create CustomAPIDevice + fire_homeassistant_event(enriched_payload)
    ESPAPI->>HA: deliver Home Assistant event
    HA-->>ESPAPI: ack
    ESPAPI-->>API: return status
    API-->>YAML: return
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Focus areas:
    • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp / .h — payload composition, logging levels, watchdog/delay behavior, and correct use of CustomAPIDevice::fire_homeassistant_event.
    • YAML touch/button changes — ensure payload shape and field names match consumers and no regression from replacing homeassistant.event.
    • Consistency of renamed tags, build flags, and preprocessor guards to avoid build-time mismatches.
    • Initialization timing and publication of cached_device_name (wifi.on_connect vs. when callers fire events).

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Move HA event handling to component' clearly summarizes the main objective: extracting Home Assistant event firing functionality into a reusable component API, as evidenced by the new tx_ultimate_easy_api files and widespread refactoring of event calls across YAML files.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml (1)

273-279: Keep tx_device_name consistent with cached_device_name

tx_device_name now exposes esphome::tx_ultimate_easy::cached_device_name in its lambda:

lambda: |-
  return { esphome::tx_ultimate_easy::cached_device_name };

but publish_device_info still publishes the raw App.get_name():

tx_device_name->publish_state(App.get_name().c_str());

So the HA text sensor can diverge from the cached/sanitized name used in your new event helper.

To keep everything aligned (events, logs, and the diagnostic sensor), consider publishing the cached value instead:

-      - lambda: |-
-          tx_fw_version->publish_state("${version}");
-          tx_device_name->publish_state(App.get_name().c_str());
+      - lambda: |-
+          tx_fw_version->publish_state("${version}");
+          tx_device_name->publish_state(esphome::tx_ultimate_easy::cached_device_name.c_str());

(Assuming cached_device_name is guaranteed to be initialized by the time publish_device_info runs; otherwise you might also want a small helper to initialize/fill it once.)

Also applies to: 349-358

🧹 Nitpick comments (6)
ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml (2)

380-388: Multi‑touch HA event wiring looks good

Using fire_ha_event("touch", "multi_touch", …) with action="release" and position centralizes the HA wiring nicely and lines up with the new API. If you ever want stricter validation, you could mirror the range check you use for long‑touch, but it’s not strictly necessary here.


407-418: Swipe event payloads: confirm “action” semantics vs direction

The new swipe handlers look consistent and model‑aware:

const char *direction = (sl_tx_model_format->state == "...EU...") ? "left"/"right" : "down"/"up";

and you send:

{"action", direction},
{"swipe-direction", direction},

This duplicates the direction in two keys and makes action hold the direction, while for multi‑touch action represents "release".

If your intent is:

  • type → high‑level kind ("swipe")
  • action → verb ("swipe")
  • swipe-direction"left" | "right" | "up" | "down"

you might want to instead keep direction only in swipe-direction and reserve action for something like "swipe". If you are maintaining compatibility with existing automations that look at action for the direction, then the current shape is fine—just worth double‑checking.

Also applies to: 419-429

components/tx_ultimate_easy/tx_ultimate_easy_api.h (3)

4-9: Add missing standard includes for std::string and std::map

This header publicly exposes std::string and std::map but only includes <cstdint>. Relying on transitive includes from other headers is brittle.

Consider:

-#include <cstdint>
+#include <cstdint>
+#include <map>
+#include <string>

This makes the header self‑contained and safer against upstream include changes.

Also applies to: 17-19, 55-76


17-19: Remove duplicate extern cached_device_name declaration

cached_device_name is declared twice:

// Cached device name to avoid repeated lookups and string copies
extern std::string cached_device_name;
...
// Cached device name to avoid repeated lookups and string copies
extern std::string cached_device_name;

You can drop one of them (the second block at Lines 52–54 is redundant) to avoid noise.

-    // Cached device name to avoid repeated lookups and string copies
-    extern std::string cached_device_name;
-

Also applies to: 52-54


55-76: Sync fire_ha_event documentation with the actual API

The doc block is slightly out of date:

  • It says “Automatically adds device_name and type” but the implementation also adds firmware and domain.
  • It references init_device_name_cache() which doesn’t exist now (name is initialized via WiFi on_connect instead).
  • The example omits the domain parameter and doesn’t match the current signature.

Suggest updating the comment and example to something like:

/**
 * @brief Fire a Home Assistant event for TX Ultimate Easy.
 *
 * Automatically adds device_name, firmware, domain and type to the event data.
 *
 * @param domain Event domain (e.g., "touch", "audio", "relay").
 * @param type   Event type   (e.g., "multi_touch", "swipe", "boot").
 * @param data   Additional event data; core fields are injected automatically.
 *
 * @note The event name is fixed to "esphome.tx_ultimate_easy".
 *
 * @code
 * fire_ha_event("touch", "swipe", {
 *   {"swipe-direction", "left"},
 *   {"position", "3"}
 * });
 * @endcode
 */

to avoid confusion for future callers.

ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml (1)

366-382: Name sanitization on Wi‑Fi connect is good; small ctype nit

The wifi.on_connect lambda that builds cached_device_name from App.get_name() is a nice central place to normalize the HA‑safe name and publish it.

One minor C++/ctype detail: isalnum(c) and tolower(c) expect an unsigned char (or EOF). Passing a plain char can be UB for non‑ASCII values on some platforms.

If you want to be fully defensive, you could tweak the loop body to:

for (const char &c : App.get_name()) {
  unsigned char uc = static_cast<unsigned char>(c);
  if (isalnum(uc)) {
    esphome::tx_ultimate_easy::cached_device_name += static_cast<char>(tolower(uc));
    last_was_underscore = false;
  } else if (!last_was_underscore) {
    esphome::tx_ultimate_easy::cached_device_name += '_';
    last_was_underscore = true;
  }
}

Functionally you’re fine for typical ASCII hostnames; this is just a robustness polish.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd39fee and 0d49f10.

📒 Files selected for processing (4)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml (3 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml (2 hunks)
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (1 hunks)
  • components/tx_ultimate_easy/tx_ultimate_easy_api.h (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
📚 Learning: 2025-08-11T22:06:11.073Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml
  • components/tx_ultimate_easy/tx_ultimate_easy_api.h
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
📚 Learning: 2025-08-05T19:18:45.684Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:547-561
Timestamp: 2025-08-05T19:18:45.684Z
Learning: In the TX Ultimate Easy project's light_attributes_restore script in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml, the user intentionally chose to restore only brightness and RGB attributes without turning the light on. The design uses C++ lambdas instead of ESPHome YAML functions specifically to avoid automatically turning lights on during restoration, allowing users to manually control the on/off state while preserving visual settings.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml
📚 Learning: 2025-07-09T22:37:04.600Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml
  • components/tx_ultimate_easy/tx_ultimate_easy_api.h
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
📚 Learning: 2025-08-10T21:47:55.413Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ IDF Core (dev)
🔇 Additional comments (2)
components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (1)

8-12: Event helper structure and logging look solid

The centralized fire_ha_event helper, including the per‑event logging and the use of esphome::api::CustomAPIDevice, aligns well with the recommended ESPHome pattern and should make HA event wiring from YAML much cleaner.

Also applies to: 21-29, 31-36

ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml (1)

32-37: Core wiring (tag, HA services, firmware macro) looks consistent

Updating TAG_CORE_COMMON, enabling homeassistant_services, and adding the TX_ULTIMATE_EASY_FIRMWARE_VERSION build flag all line up with the new centralized HA event helper and firmware reporting. No issues here from a config standpoint.

Also applies to: 87-90

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (1)

127-137: Based on my verification, I've discovered a critical inconsistency in how Home Assistant events are fired across the codebase. The review comment raised valid concerns but missed the core issue. Here's the rewritten review:


Use the esphome::tx_ultimate_easy::fire_ha_event() wrapper instead of CustomAPIDevice directly for consistency.

The tx_ultimate_easy component provides a dedicated fire_ha_event() wrapper function (defined in components/tx_ultimate_easy/tx_ultimate_easy_api.h:74) that automatically handles device_name, firmware, domain, and type fields. The hw_touch.yaml component correctly uses this wrapper, but hw_buttons.yaml (lines 127-137) and common.yaml (lines 151-155) bypass it by directly instantiating CustomAPIDevice and calling fire_homeassistant_event().

Replace the manual CustomAPIDevice pattern with:

esphome::tx_ultimate_easy::fire_ha_event("touch", "button", {
  {"action", action.c_str()},
  {"button_id", std::to_string(button)},
  {"count", std::to_string(count)},
  {"position", std::to_string(id(button_press_position))}
});

This ensures API consistency, simplifies code, and uses the documented public interface. tx_device_name is properly defined in common.yaml and available; the issue is architectural inconsistency, not availability.

🧹 Nitpick comments (2)
ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml (1)

5-5: Update file header comment to match new naming convention.

The file header at line 5 still references "Standard - Hardware - Speaker", but the new log message at line 89 shortened it to "Hardware - Speaker". For consistency, update the header comment.

-##### Purpose: ESPHome - Standard - Hardware - Speaker                                         #####
+##### Purpose: ESPHome - Hardware - Speaker                                                    #####
ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml (1)

5-5: Update file header comment to match new naming convention.

The file header at line 5 still references "Standard - I2S Audio", but the new log message at line 40 shortened it to "Hardware - Audio". For consistency, update the header comment.

-##### Purpose: ESPHome - Standard - I2S Audio                                                  #####
+##### Purpose: ESPHome - I2S Audio                                                             #####
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2bfa99 and 399eaeb.

📒 Files selected for processing (8)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml (2 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (5 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml (11 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml (19 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml (3 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml (4 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml (3 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.
📚 Learning: 2025-08-11T22:06:11.073Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml
📚 Learning: 2025-08-10T21:47:55.413Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml
📚 Learning: 2025-08-05T19:20:33.157Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:72-76
Timestamp: 2025-08-05T19:20:33.157Z
Learning: In the TX Ultimate Easy project, the `attr_light_output_1` global variable in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml is intentionally saved but not restored on boot because the restoration logic will be implemented in the hw_leds area in the near future. The `light_attributes_restore` script consumer is planned to be in the hw_relays area while the script itself remains in hw_leds as part of the ongoing storage optimization work.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml
📚 Learning: 2025-08-05T19:18:45.684Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:547-561
Timestamp: 2025-08-05T19:18:45.684Z
Learning: In the TX Ultimate Easy project's light_attributes_restore script in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml, the user intentionally chose to restore only brightness and RGB attributes without turning the light on. The design uses C++ lambdas instead of ESPHome YAML functions specifically to avoid automatically turning lights on during restoration, allowing users to manually control the on/off state while preserving visual settings.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml
📚 Learning: 2025-07-29T08:10:32.072Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 112
File: .github/workflows/validate_esphome_dev.yml:52-210
Timestamp: 2025-07-29T08:10:32.072Z
Learning: Media player functionality is now supported by both Arduino and IDF frameworks in TX Ultimate Easy ESPHome configurations, removing the previous Arduino-only limitation.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml
📚 Learning: 2024-12-26T21:18:44.593Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 73
File: ESPHome/TX-Ultimate-Easy-ESPHome_addon_media_player.yaml:14-20
Timestamp: 2024-12-26T21:18:44.593Z
Learning: In the TX Ultimate Easy ESPHome setup, the i2s_dout_pin for audio output is defined in respective speaker or media_player components rather than in the core_hw_audio package.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml
📚 Learning: 2025-08-06T21:11:16.509Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1356-1358
Timestamp: 2025-08-06T21:11:16.509Z
Learning: In the TX Ultimate Easy project's relay light mode selectors in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, the fallback value for active_index().value_or(1) is intentionally set to 1, which corresponds to the first active light mode (Bottom for EU, Left for US) rather than 0 (Disabled). This ensures the default behavior maintains LED functionality rather than disabling lights on cold boot.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2024-12-21T22:36:10.732Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 50
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml:201-222
Timestamp: 2024-12-21T22:36:10.732Z
Learning: The user clarified that handling millisecond overflow for button press duration is unnecessary because the relevant logic only runs if current_time is strictly greater than the recorded start time.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
📚 Learning: 2024-12-24T22:40:00.309Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 71
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml:20-21
Timestamp: 2024-12-24T22:40:00.309Z
Learning: The BLE addon uses a unique speaker component named mp_speaker and removes the media_player component entirely, so no rename from mp_speaker to mp_media_player is required there.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
📚 Learning: 2025-08-10T19:32:07.897Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1326-1333
Timestamp: 2025-08-10T19:32:07.897Z
Learning: In the TX Ultimate Easy project's relay light modes in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, "Disabled" mode intentionally decouples LED control from relay state changes, allowing users to control the LEDs independently via other means (e.g., Home Assistant). When transitioning TO "Disabled" mode at runtime, lights should turn off. When transitioning FROM "Disabled" to another mode, lights should update based on the current relay state. These transitions should only occur during runtime mode changes, not during boot/restore, to preserve user-defined light states.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-08-06T20:53:35.572Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:558-576
Timestamp: 2025-08-06T20:53:35.572Z
Learning: In the TX Ultimate Easy project, brightness values are already clamped using std::min(attr.brightness, uint8_t(100)) in the pack_light_attributes() and unpack_light_attributes() functions in components/tx_ultimate_easy/tx_ultimate_easy_light.cpp. RGB values are naturally constrained by uint8_t casting and bit masking operations. No additional clamping is needed at the calling sites in the ESPHome YAML files.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-08-08T12:08:27.935Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:0-0
Timestamp: 2025-08-08T12:08:27.935Z
Learning: In TX Ultimate Easy, the default packed dual light attributes constant must be 0x64FFFFFF64FFFFFF (16 hex digits) across YAML substitutions (LIGHT_DUAL_ATTRS_DEFAULT) and C++ (DEFAULT_DUAL_LIGHT_ATTRS_PACKED). Avoid leading zeros that would push beyond 64 bits.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-08-01T08:21:34.925Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 112
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:53-57
Timestamp: 2025-08-01T08:21:34.925Z
Learning: The `esp32_rmt_led_strip` platform in ESPHome does not support a `rmt_channel` parameter. Valid parameters include pin, num_leds, chipset, rgb_order (required) and is_rgbw, is_wrgb, max_refresh_rate, use_psram, rmt_symbols, use_dma (optional). The platform handles RMT channel allocation internally.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
📚 Learning: 2024-12-22T00:26:54.059Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 50
File: components/tx_ultimate_easy/tx_ultimate_easy.cpp:54-59
Timestamp: 2024-12-22T00:26:54.059Z
Learning: The default value for gang_count_ in TxUltimateEasy is already initialized to 1 in the header file, removing the need for additional constructor initialization.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
🔇 Additional comments (18)
ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml (1)

19-19: Systematic tag and build-flag renaming is consistent and correct.

The refactoring from TAG_STD_*TAG_*, TX_ULTIMATE_EASY_STANDARD_*TX_ULTIMATE_EASY_*, and preprocessor symbol updates align with the dependency chain. Package include references and build flags are properly set.

Also applies to: 22-22, 36-36, 43-43, 81-86, 89-89

ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml (1)

15-15: Tag and build-flag refactoring is complete and consistent.

All tag references updated from TAG_STD_MEDIA_PLAYERTAG_MEDIA_PLAYER, build flag corrected (also fixing the typo ULTIATEULTIMATE), and preprocessor guards properly check for required dependencies (COMMON and HW_SPEAKER).

Also applies to: 18-18, 23-23, 60-60, 73-76, 83-88, 91-91, 102-102

ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml (1)

17-17: Tag and build-flag refactoring is consistent and correctly updates dependencies.

The transition from TAG_STD_HW_AUDIOTAG_HW_AUDIO, build-flag standardization, and preprocessor check update to TX_ULTIMATE_EASY_COMMON are all properly aligned.

Also applies to: 22-22, 35-35, 40-40

ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml (4)

604-619: Logging tag updates are systematic and complete.

All ESP_LOGCONFIG, ESP_LOGE, ESP_LOGD, ESP_LOGI, and ESP_LOGW calls have been updated to use the new ${TAG_HW_LEDS} substitution consistently. The refactoring is thorough across the entire logging context (transition times, restore modes, attribute handling, effect handling, and error conditions).

Also applies to: 641-789


631-631: Logging hierarchy is correct and consistent with other hardware packages.

Line 631 correctly uses ESPHOME_PROJECT_NAME for a high-level summary header, which aligns with the established logging pattern across all hardware packages in the project. Detailed configuration logs (e.g., lines 604–619 in the same file) use component-specific tags like ${TAG_HW_LEDS}, while summary headers consistently use ESPHOME_PROJECT_NAME. This is confirmed in hw_audio.yaml:40 and hw_buttons.yaml:249, which follow the same pattern. No changes needed.


626-627: Package dependency naming is correctly aligned. The flag TX_ULTIMATE_EASY_COMMON is properly defined in ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (line 88, under platformio_options.build_flags), and the package check references the correct file name. The flag is used consistently across all dependent modules, and the previous flag TX_ULTIMATE_EASY_CORE_COMMON has been fully migrated.


35-35: Logging tag and build flag refactoring successfully completed with no stale references.

The systematic renaming has been thoroughly applied:

  • TAG_HW_LEDS correctly substituted (line 35)
  • TX_ULTIMATE_EASY_HW_LEDS build flag properly set (line 40)
  • Package dependency correctly updated to TX_ULTIMATE_EASY_COMMON (line 626) with matching definition in common.yaml
  • Error message references correct package file (line 627)
  • All logging calls use the new tag name

Search confirmed zero remaining references to old names (TX_ULTIMATE_EASY_CORE_HW_LEDS or TAG_CORE_HW_LEDS) across the codebase. No other files depend on these old identifiers.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (2)

39-39: Tag and build flag renaming applied consistently.

The substitution tag and build flag changes from core_hw_buttons to hw_buttons are reflected correctly throughout the file with consistent naming.

Also applies to: 65-65


244-246: Build flag is properly defined in the renamed common.yaml package.

The verification confirms that TX_ULTIMATE_EASY_COMMON is correctly defined at line 88 of ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml with the compiler directive -D TX_ULTIMATE_EASY_COMMON. The preprocessor check at lines 244-246 of hw_buttons.yaml properly references this flag, and the same pattern is consistently used across all related files (hw_leds.yaml, hw_relays.yaml, hw_touch.yaml, etc.). No issues detected.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml (5)

289-292: Logging tag updates look consistent.

All ESP_LOG* calls have been properly updated to reference ${TAG_HW_TOUCH} instead of the previous tag. The log levels and messages are appropriate.

Also applies to: 375-377, 395-398, 404-404, 433-435


383-386: I'll help you verify the fire_ha_event API usage in the ESPHome configuration. Let me search for the function definition and examine the component structure.
<function_calls>

#!/bin/bash

Search for fire_ha_event function definition

echo "=== Searching for fire_ha_event function definition ==="
find . -type f ( -name ".cpp" -o -name ".h" ) | xargs grep -l "fire_ha_event" 2>/dev/null | head -10

echo -e "\n=== Searching for tx_ultimate_easy component ==="
find . -type d -name "tx_ultimate_easy" 2>/dev/null

echo -e "\n=== Looking for component structure ==="
find . -type f -name "*.h" | xargs grep -l "tx_ultimate_easy" 2>/dev/null | head -10


</function_calls>

I need to wait for the shell script results to verify the fire_ha_event function. Please execute the script above to gather information about the API definition and component structure.


299-301: The preprocessor check change is correct and intentional—TX_ULTIMATE_EASY_COMMON is properly defined in common.yaml and is a standardized dependency across all hardware modules.

Verification confirms that TX_ULTIMATE_EASY_COMMON is defined in ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml as a build flag (-D TX_ULTIMATE_EASY_COMMON). This change is part of a consistent architectural pattern: all hardware modules in the project (media_player, hw_vibration, hw_speaker, hw_relays, hw_leds, hw_buttons, hw_audio, and hw_touch) use the same dependency check for common.yaml. This standardization confirms that common.yaml is an intentional universal dependency for all hardware components.


17-17: No issues found. The renamed substitutions and build flags have been properly updated throughout the codebase.

The verification confirms that:

  • No references to the old TAG_CORE_HW_TOUCH or TX_ULTIMATE_EASY_CORE_HW_TOUCH identifiers remain in the codebase
  • The new TAG_HW_TOUCH substitution is defined and used consistently across all logging statements
  • The new TX_ULTIMATE_EASY_HW_TOUCH build flag is properly applied in both the header/cpp files and the YAML configuration
  • All references are syntactically correct and consistent

410-410: The TX_MODEL_FORMAT_EU_TEXT substitution is properly defined and accessible.

The substitution is defined in common.yaml (line 22) as "EU (Square, T5-xC-86)" and is included before hw_touch.yaml in core.yaml (lines 16–19), ensuring availability when the lambda code executes. The comparison logic at lines 410 and 422 is correct and follows the same pattern used elsewhere in the codebase. Additionally, hw_touch.yaml includes a C++ preprocessor guard (#if !defined(TX_ULTIMATE_EASY_COMMON)) that will error if common.yaml is not included, providing compile-time validation of the dependency.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml (4)

818-818: Logging tag refactoring is consistent and complete.

All ESP_LOG* calls have been systematically updated from the old tag to ${TAG_HW_RELAYS}. The string interpolation format is consistent, and logging behavior is preserved. No apparent orphaned references to the old tag name detected.

Also applies to: 959-966, 998-1003, 1011-1065, 1104-1148, 1331-1332, 1382-1389, 1437-1444, 1501-1508, 1542-1549, 1606-1613, 1647-1654, 1711-1716, 1750-1755


1-13: File header and purpose remain clear.

The file header and purpose statement are unchanged, maintaining clarity that this is the ESPHome Hardware Relays configuration. The renaming of tags and build flags does not affect documentation or intent.


26-26: Build flag alignment is correct and complete.

The build flag TX_ULTIMATE_EASY_HW_RELAYS (line 31) and substitution tag TAG_HW_RELAYS: tx_ultimate_easy.hw.relays (line 26) are properly defined. Related required flags (TX_ULTIMATE_EASY_COMMON and TX_ULTIMATE_EASY_HW_LEDS) are defined in their respective YAML files, and preprocessor guards (lines 1071–1076) correctly validate their presence. No separate C++ component files for relays exist—all relay logic is inline in the YAML configuration. No remnants of the old naming convention remain.


1071-1076: Manual verification required—repository access unavailable.

The repository clone failed, preventing automated verification of the preprocessor guard definitions. To confirm these changes are correct, manually verify that:

  1. ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml defines TX_ULTIMATE_EASY_COMMON in its esphome.platformio_options.build_flags section
  2. ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml defines TX_ULTIMATE_EASY_HW_LEDS in its esphome.platformio_options.build_flags section
  3. Old guard names (TX_ULTIMATE_EASY_CORE_COMMON and TX_ULTIMATE_EASY_CORE_HW_LEDS) no longer appear in build_flags

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (1)

125-137: Event emission via CustomAPIDevice is functional but consider migration path.

The button_action script emits Home Assistant events using esphome::api::CustomAPIDevice::fire_homeassistant_event(). While this works, note that hw_touch.yaml has migrated to using esphome::tx_ultimate_easy::fire_ha_event() for similar event emission.

For consistency across the codebase, consider whether button_action should also use the new centralized fire_ha_event() API in a future refactor. For now, this implementation is acceptable and functional.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 399eaeb and 3f343b8.

📒 Files selected for processing (8)
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (6 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (5 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml (17 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml (6 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml (4 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml (6 hunks)
  • versioning/VERSION (1 hunks)
  • versioning/VERSION_YAML (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • versioning/VERSION
  • versioning/VERSION_YAML
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.
📚 Learning: 2025-08-11T22:06:11.073Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
📚 Learning: 2025-08-10T21:47:55.413Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
📚 Learning: 2025-08-05T19:20:33.157Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:72-76
Timestamp: 2025-08-05T19:20:33.157Z
Learning: In the TX Ultimate Easy project, the `attr_light_output_1` global variable in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml is intentionally saved but not restored on boot because the restoration logic will be implemented in the hw_leds area in the near future. The `light_attributes_restore` script consumer is planned to be in the hw_relays area while the script itself remains in hw_leds as part of the ongoing storage optimization work.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
📚 Learning: 2025-08-05T19:18:45.684Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:547-561
Timestamp: 2025-08-05T19:18:45.684Z
Learning: In the TX Ultimate Easy project's light_attributes_restore script in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml, the user intentionally chose to restore only brightness and RGB attributes without turning the light on. The design uses C++ lambdas instead of ESPHome YAML functions specifically to avoid automatically turning lights on during restoration, allowing users to manually control the on/off state while preserving visual settings.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
📚 Learning: 2025-07-29T08:10:32.072Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 112
File: .github/workflows/validate_esphome_dev.yml:52-210
Timestamp: 2025-07-29T08:10:32.072Z
Learning: Media player functionality is now supported by both Arduino and IDF frameworks in TX Ultimate Easy ESPHome configurations, removing the previous Arduino-only limitation.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
📚 Learning: 2025-08-06T21:11:16.509Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1356-1358
Timestamp: 2025-08-06T21:11:16.509Z
Learning: In the TX Ultimate Easy project's relay light mode selectors in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, the fallback value for active_index().value_or(1) is intentionally set to 1, which corresponds to the first active light mode (Bottom for EU, Left for US) rather than 0 (Disabled). This ensures the default behavior maintains LED functionality rather than disabling lights on cold boot.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-08-10T19:32:07.897Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1326-1333
Timestamp: 2025-08-10T19:32:07.897Z
Learning: In the TX Ultimate Easy project's relay light modes in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, "Disabled" mode intentionally decouples LED control from relay state changes, allowing users to control the LEDs independently via other means (e.g., Home Assistant). When transitioning TO "Disabled" mode at runtime, lights should turn off. When transitioning FROM "Disabled" to another mode, lights should update based on the current relay state. These transitions should only occur during runtime mode changes, not during boot/restore, to preserve user-defined light states.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2024-12-26T21:18:44.593Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 73
File: ESPHome/TX-Ultimate-Easy-ESPHome_addon_media_player.yaml:14-20
Timestamp: 2024-12-26T21:18:44.593Z
Learning: In the TX Ultimate Easy ESPHome setup, the i2s_dout_pin for audio output is defined in respective speaker or media_player components rather than in the core_hw_audio package.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
📚 Learning: 2024-12-21T22:36:10.732Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 50
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml:201-222
Timestamp: 2024-12-21T22:36:10.732Z
Learning: The user clarified that handling millisecond overflow for button press duration is unnecessary because the relevant logic only runs if current_time is strictly greater than the recorded start time.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
📚 Learning: 2024-12-19T22:29:32.736Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 31
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml:82-88
Timestamp: 2024-12-19T22:29:32.736Z
Learning: Due to "restore_mode: ALWAYS_OFF" and a turn-off step on OTA, the vibration motor is automatically shut off in restart/OTA scenarios, making additional race-condition handling unnecessary.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml
📚 Learning: 2025-08-06T20:53:35.572Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:558-576
Timestamp: 2025-08-06T20:53:35.572Z
Learning: In the TX Ultimate Easy project, brightness values are already clamped using std::min(attr.brightness, uint8_t(100)) in the pack_light_attributes() and unpack_light_attributes() functions in components/tx_ultimate_easy/tx_ultimate_easy_light.cpp. RGB values are naturally constrained by uint8_t casting and bit masking operations. No additional clamping is needed at the calling sites in the ESPHome YAML files.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-08-08T12:08:27.935Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:0-0
Timestamp: 2025-08-08T12:08:27.935Z
Learning: In TX Ultimate Easy, the default packed dual light attributes constant must be 0x64FFFFFF64FFFFFF (16 hex digits) across YAML substitutions (LIGHT_DUAL_ATTRS_DEFAULT) and C++ (DEFAULT_DUAL_LIGHT_ATTRS_PACKED). Avoid leading zeros that would push beyond 64 bits.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2024-12-22T00:26:54.059Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 50
File: components/tx_ultimate_easy/tx_ultimate_easy.cpp:54-59
Timestamp: 2024-12-22T00:26:54.059Z
Learning: The default value for gang_count_ in TxUltimateEasy is already initialized to 1 in the header file, removing the need for additional constructor initialization.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2024-12-24T22:40:00.309Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 71
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml:20-21
Timestamp: 2024-12-24T22:40:00.309Z
Learning: The BLE addon uses a unique speaker component named mp_speaker and removes the media_player component entirely, so no rename from mp_speaker to mp_media_player is required there.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ Arduino Core (latest)
🔇 Additional comments (17)
ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (5)

32-32: Verify homeassistant_services: true is required for event emission.

The API configuration has been updated to enable Home Assistant services. Ensure that the tx_ultimate_easy C++ component's fire_ha_event implementation correctly leverages this setting to emit events to Home Assistant.

Also applies to: 36-36


82-82: Verify ESPHome minimum version requirement.

The min_version has been updated to 2025.11.0. Confirm that this version bump is necessary for the new homeassistant_services API feature or other changes in this PR, and document the reason if it's a breaking change.


186-191: String comparison logic is correct.

Line 187 correctly uses current_option() to get the model format as a string before comparing. The logic is sound and aligns with the approach used in other files (hw_speaker, hw_vibration, hw_touch).


357-358: Device name caching integration looks correct.

The text_sensor now returns esphome::tx_ultimate_easy::cached_device_name. This assumes the variable is properly declared as extern in the tx_ultimate_easy_api.h header and initialized during wifi connection.

Confirm that cached_device_name is declared as extern std::string in the tx_ultimate_easy_api.h component header, and that it is initialized early enough to prevent stale state.


366-382: Device name generation on wifi connect is well-implemented.

The logic correctly filters alphanumeric characters (converting to lowercase) and replaces non-alphanumeric sequences with underscores while avoiding consecutive underscores. This is a robust approach for generating valid device identifiers on first connection.

One minor observation: The cache is populated only once (when cached_device_name.empty()). Ensure this is the intended behavior and that manual device name changes in Home Assistant do not require re-initialization.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml (2)

81-89: Preprocessor guard naming is consistent.

The error checks have been updated to reference TX_ULTIMATE_EASY_COMMON and TX_ULTIMATE_EASY_HW_AUDIO, replacing the old TX_ULTIMATE_EASY_CORE_COMMON naming. This is consistent with the build flag changes in the file.


134-134: String comparisons using strcmp are appropriate.

The conditional checks correctly use strcmp to compare current_option() string results against literal values. The use of logical OR for multiple matching options ("On press" OR "Always", "On release" OR "Always") is correct and idiomatic.

Also applies to: 146-149, 159-162

ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (1)

224-237: Use of current_option() for displaying selector state is correct.

Lines 224-237 correctly retrieve the current option text from button action selectors and display them in config logs. The pattern is consistent across this file and others.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml (1)

17-17: Tag, build flag, and strcmp logic are all consistent.

This file follows the standardized naming pattern:

  • TAG renamed to TAG_HW_VIBRATION
  • Build flag updated to TX_ULTIMATE_EASY_HW_VIBRATION
  • All logging migrated to new tag
  • Preprocessor guard correctly references TX_ULTIMATE_EASY_COMMON
  • strcmp conditionals for "On press", "On release", "Always", "Disabled" are correct

Also applies to: 40-40, 67-76, 83-88, 98-98, 110-113, 123-126

ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml (3)

383-386: Migration to centralized fire_ha_event() API is clean.

The on_multi_touch_release event emission has been migrated to esphome::tx_ultimate_easy::fire_ha_event("touch", "multi_touch", {...}). The payload structure includes action ("release") and position.

Confirm that the fire_ha_event() function signature accepts domain (string), type (string), and data (map), and that it automatically includes device_name, firmware, and other enriched context in the emitted event.


410-417: Swipe event direction logic correctly maps model format.

The swipe events use model-aware direction mapping:

  • EU model: swipe_left → "left", swipe_right → "right"
  • US model: swipe_left → "down", swipe_right → "up"

This correctly accounts for the 90° rotation between EU (square) and US (rectangle) layouts. The current_option() comparison is correct.

Also applies to: 423-430


375-405: Long-touch and press event logging is consistent.

Logging for on_long_touch_release, on_press, and on_release events have all been updated to use TAG_HW_TOUCH. Validation of touch position bounds is preserved and appropriate.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml (5)

969-990: Use of current_option() for button action retrieval is appropriate.

Lines 969, 976, 983, 990 correctly call current_option() to retrieve the current button action as a string, enabling comparison with action text constants. This replaces any previous state-based access and is consistent across the file.


1013-1023: Relay mode and LED mode logging correctly uses current_option().

The dump_config script retrieves and displays current relay modes and light modes using current_option(), with model-aware selection (ternary operator) for EU vs US light mode selectors. The logic is sound and maintains readability.

Also applies to: 1050-1064


1071-1080: Preprocessor guards are updated and consistent.

The #if !defined(...) checks have been updated to reference TX_ULTIMATE_EASY_COMMON and TX_ULTIMATE_EASY_HW_LEDS, matching the build flag renames. The error messages are clear and helpful.


1308-1327: Light mode retrieval using current_option() is correct.

The show_relay_status script correctly retrieves light mode for each relay using current_option() on the model-appropriate selector (EU or US) based on is_us_model. The ternary logic is clear and maintains consistency.


1382-1389: Light mode transition logging is comprehensive and uses updated tag.

All relay light mode transitions (TO/FROM Disabled) have been updated to use TAG_HW_RELAYS. The static local variable pattern for tracking previous_mode per relay is maintained and correct. Transition logic (turning off lights when entering Disabled, updating based on relay state when leaving Disabled) is preserved.

Also applies to: 1437-1444, 1501-1508, 1542-1549, 1606-1613, 1647-1654, 1711-1755

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (1)

358-358: Centralized device naming pattern is clean, but add defensive checks for initialization order.

The wifi.on_connect handler at lines 366–382 correctly initializes cached_device_name by normalizing App.get_name() (lowercase alphanumerics + underscores). The logic properly avoids consecutive underscores, which is good.

However, the text_sensor at line 358 will return an empty string if accessed before WiFi connects. Consider:

  • Adding a fallback or validation in the text_sensor lambda to warn if cached_device_name remains empty
  • Or adding a note in documentation about this runtime dependency

Example defensive check:

lambda: |-
  if (esphome::tx_ultimate_easy::cached_device_name.empty()) {
    return {"<uninitialized>"};  // Safe fallback
  }
  return {esphome::tx_ultimate_easy::cached_device_name};

Also applies to: 366-382

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10a5c1a and 9112901.

📒 Files selected for processing (9)
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (7 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml (3 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (6 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml (12 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml (18 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml (7 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml (5 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml (7 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_audio.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.
📚 Learning: 2025-08-11T22:06:11.073Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml
📚 Learning: 2025-08-10T21:47:55.413Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml
📚 Learning: 2024-12-26T21:18:44.593Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 73
File: ESPHome/TX-Ultimate-Easy-ESPHome_addon_media_player.yaml:14-20
Timestamp: 2024-12-26T21:18:44.593Z
Learning: In the TX Ultimate Easy ESPHome setup, the i2s_dout_pin for audio output is defined in respective speaker or media_player components rather than in the core_hw_audio package.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
📚 Learning: 2025-08-05T19:20:33.157Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:72-76
Timestamp: 2025-08-05T19:20:33.157Z
Learning: In the TX Ultimate Easy project, the `attr_light_output_1` global variable in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml is intentionally saved but not restored on boot because the restoration logic will be implemented in the hw_leds area in the near future. The `light_attributes_restore` script consumer is planned to be in the hw_relays area while the script itself remains in hw_leds as part of the ongoing storage optimization work.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
📚 Learning: 2025-08-10T19:32:07.897Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1326-1333
Timestamp: 2025-08-10T19:32:07.897Z
Learning: In the TX Ultimate Easy project's relay light modes in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, "Disabled" mode intentionally decouples LED control from relay state changes, allowing users to control the LEDs independently via other means (e.g., Home Assistant). When transitioning TO "Disabled" mode at runtime, lights should turn off. When transitioning FROM "Disabled" to another mode, lights should update based on the current relay state. These transitions should only occur during runtime mode changes, not during boot/restore, to preserve user-defined light states.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-08-05T19:18:45.684Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:547-561
Timestamp: 2025-08-05T19:18:45.684Z
Learning: In the TX Ultimate Easy project's light_attributes_restore script in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml, the user intentionally chose to restore only brightness and RGB attributes without turning the light on. The design uses C++ lambdas instead of ESPHome YAML functions specifically to avoid automatically turning lights on during restoration, allowing users to manually control the on/off state while preserving visual settings.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
📚 Learning: 2025-08-06T21:11:16.509Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1356-1358
Timestamp: 2025-08-06T21:11:16.509Z
Learning: In the TX Ultimate Easy project's relay light mode selectors in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, the fallback value for active_index().value_or(1) is intentionally set to 1, which corresponds to the first active light mode (Bottom for EU, Left for US) rather than 0 (Disabled). This ensures the default behavior maintains LED functionality rather than disabling lights on cold boot.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
📚 Learning: 2025-08-06T20:53:35.572Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:558-576
Timestamp: 2025-08-06T20:53:35.572Z
Learning: In the TX Ultimate Easy project, brightness values are already clamped using std::min(attr.brightness, uint8_t(100)) in the pack_light_attributes() and unpack_light_attributes() functions in components/tx_ultimate_easy/tx_ultimate_easy_light.cpp. RGB values are naturally constrained by uint8_t casting and bit masking operations. No additional clamping is needed at the calling sites in the ESPHome YAML files.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-08-08T12:08:27.935Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:0-0
Timestamp: 2025-08-08T12:08:27.935Z
Learning: In TX Ultimate Easy, the default packed dual light attributes constant must be 0x64FFFFFF64FFFFFF (16 hex digits) across YAML substitutions (LIGHT_DUAL_ATTRS_DEFAULT) and C++ (DEFAULT_DUAL_LIGHT_ATTRS_PACKED). Avoid leading zeros that would push beyond 64 bits.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2024-12-22T00:26:54.059Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 50
File: components/tx_ultimate_easy/tx_ultimate_easy.cpp:54-59
Timestamp: 2024-12-22T00:26:54.059Z
Learning: The default value for gang_count_ in TxUltimateEasy is already initialized to 1 in the header file, removing the need for additional constructor initialization.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml
📚 Learning: 2025-07-29T08:10:32.072Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 112
File: .github/workflows/validate_esphome_dev.yml:52-210
Timestamp: 2025-07-29T08:10:32.072Z
Learning: Media player functionality is now supported by both Arduino and IDF frameworks in TX Ultimate Easy ESPHome configurations, removing the previous Arduino-only limitation.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
📚 Learning: 2025-07-09T22:37:04.600Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
📚 Learning: 2024-12-21T22:36:10.732Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 50
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml:201-222
Timestamp: 2024-12-21T22:36:10.732Z
Learning: The user clarified that handling millisecond overflow for button press duration is unnecessary because the relevant logic only runs if current_time is strictly greater than the recorded start time.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml
📚 Learning: 2024-12-24T22:40:00.309Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 71
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml:20-21
Timestamp: 2024-12-24T22:40:00.309Z
Learning: The BLE addon uses a unique speaker component named mp_speaker and removes the media_player component entirely, so no rename from mp_speaker to mp_media_player is required there.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml
📚 Learning: 2024-12-19T22:29:32.736Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 31
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml:82-88
Timestamp: 2024-12-19T22:29:32.736Z
Learning: Due to "restore_mode: ALWAYS_OFF" and a turn-off step on OTA, the vibration motor is automatically shut off in restart/OTA scenarios, making additional race-condition handling unnecessary.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ Arduino Core (dev)
🔇 Additional comments (12)
ESPHome/TX-Ultimate-Easy-ESPHome_hw_buttons.yaml (3)

223-232: Use of current_option() is correct for ESPHome select templates.

The migration to current_option() (lines 223–232) is the proper way to retrieve selected values in ESPHome. This is consistent with the pattern used across the codebase and aligns with the learnings from PR 120.


239-239: Build guard macro dependency must be satisfied.

Line 239 checks #if !defined(TX_ULTIMATE_EASY_COMMON), which now depends on the updated flag name from common.yaml. Ensure the guard check is defined in all code paths that include this file.


127-132: Critical issue found: firmware field is hardcoded as a string literal instead of using the macro value.

In tx_ultimate_easy_api.cpp, the fire_ha_event() function adds event enrichment fields correctly for device_name, domain, and type. However, there's a critical bug on this line:

data["firmware"] = "TX_ULTIMATE_EASY_FIRMWARE_VERSION";

This passes the literal string "TX_ULTIMATE_EASY_FIRMWARE_VERSION" instead of expanding the macro. It should be:

data["firmware"] = TX_ULTIMATE_EASY_FIRMWARE_VERSION;

Without the quotes, the preprocessor will substitute the actual firmware version (defined at the top of the header as #define TX_ULTIMATE_EASY_FIRMWARE_VERSION "unknown" or a specific version). Currently, all fired events will report firmware="TX_ULTIMATE_EASY_FIRMWARE_VERSION" as a literal string instead of the actual version value.

The original review comment was correct in identifying the need to verify event enrichment — device_name enrichment works as expected via the cached_device_name variable, but the firmware version is broken.

⛔ Skipped due to learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:72-76
Timestamp: 2025-08-05T19:20:33.157Z
Learning: In the TX Ultimate Easy project, the `attr_light_output_1` global variable in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml is intentionally saved but not restored on boot because the restoration logic will be implemented in the hw_leds area in the near future. The `light_attributes_restore` script consumer is planned to be in the hw_relays area while the script itself remains in hw_leds as part of the ongoing storage optimization work.
ESPHome/TX-Ultimate-Easy-ESPHome_hw_touch.yaml (2)

383-386: Swipe direction mapping logic is correct but verify initialization timing.

The touch panel event handlers now use fire_ha_event() instead of YAML homeassistant.event blocks. The swipe direction mapping (lines 410–417 and 423–429) correctly adapts based on model format:

  • EU: horizontal swipes map to "left"/"right"
  • US: horizontal swipes map to "down"/"up"

However, this depends on sl_tx_model_format->current_option() being initialized. Verify that:

  1. Model format selection is guaranteed to be initialized before touch events fire (typically done in boot_initialize_touch_format at line 235)
  2. If called before initialization, current_option() has a safe return value (not null/empty)

Consider adding a safety check or assert if the model format is not yet available.

Also applies to: 410-417, 423-429


299-304: Guard macro and package reference consistency verified.

The required package check at lines 299–304 correctly references TX_ULTIMATE_EASY_COMMON, aligning with the common.yaml changes. The error message is clear.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_relays.yaml (2)

1013-1024: Extensive use of current_option() assumes selects are initialized — add safety checks where appropriate.

Lines 1013–1024 and 1050–1064 extensively use current_option() to retrieve relay mode and light mode settings. This is the correct ESPHome pattern, but it assumes the select entities have been initialized.

Consider adding defensive checks in log statements if selects might not have state yet:

// Example defensive approach
ESP_LOGCONFIG("${TAG_HW_RELAYS}", "  Relay 1: %s", 
  sl_relay_1_mode->has_state() ? sl_relay_1_mode->current_option() : "Unknown");

(Note: This pattern is already present at some call sites, e.g., line 1013-1014, which is good.)

Current implementation already includes these checks in most places, which is solid defensive coding.

Also applies to: 1050-1064


1071-1076: The TX_ULTIMATE_EASY_HW_LEDS build guard is already properly defined in the hw_leds component.

The guard is defined at line 40 of ESPHome/TX-Ultimate-Easy-ESPHome_hw_leds.yaml using the correct ESPHome preprocessor syntax (- -D TX_ULTIMATE_EASY_HW_LEDS). The check at line 1074 in hw_relays.yaml will succeed as long as hw_leds is included first, which the earlier check at line 1071-1072 ensures.

Likely an incorrect or invalid review comment.

ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml (2)

98-98: String comparisons with strcmp() are correct — verify literals match select options exactly.

The use of strcmp() with current_option() is a safe and appropriate pattern for string comparisons in ESPHome C++ lambdas. The logic correctly handles:

  • Line 98: Skip if NOT "Disabled"
  • Lines 110–111: Vibrate if "On press" OR "Always"
  • Lines 123–124: Vibrate if "On release" OR "Always"

Verify that the string literals exactly match the select options (lines 140–143):

  • "Disabled" ✓
  • "On press" ✓
  • "On release" ✓
  • "Always" ✓

All string literals match. The implementation is correct and follows ESPHome best practices.

Also applies to: 110-111, 123-124


83-85: Guard macro dependency satisfied.

Line 83–85 checks TX_ULTIMATE_EASY_COMMON, which aligns with the updates to common.yaml. This is consistent across the codebase.

ESPHome/TX-Ultimate-Easy-ESPHome_media_player.yaml (1)

15-15: Package reference rename is correctly implemented—no verification issues found.

The package file TX-Ultimate-Easy-ESPHome_hw_speaker.yaml exists and is properly referenced. Build guards TX_ULTIMATE_EASY_HW_SPEAKER and TX_ULTIMATE_EASY_COMMON are correctly defined in their respective package files with -D compiler flags. Old references to standard_hw_speaker remain only in comments and documentation (safe). The include statement and error message at line 18 both use the correct new filename.

ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (2)

36-36: Verify homeassistant_services: true enables fire_ha_event API correctly.

Verified. The fire_ha_event() implementation correctly uses esphome::api::CustomAPIDevice to fire Home Assistant events through the ESPHome API server. With homeassistant_services: true enabled at line 36, the API server component is active and all event calls from buttons, touch, and relay components properly integrate. Event structure adds device metadata (device_name, firmware, domain, type) to user-provided data before firing as "esphome.tx_ultimate_easy" event.


32-32: Based on my verification, I can now provide the rewritten review comment.


Build flag migration is complete; timing behavior is intentional and safe.

The build flag change from TX_ULTIMATE_EASY_CORE_COMMON to TX_ULTIMATE_EASY_COMMON has been properly applied across all dependent files. No orphaned references remain, and all files use the new flag consistently with #if !defined(TX_ULTIMATE_EASY_COMMON) guards.

Regarding the text_sensor timing: The implementation uses lazy initialization with an idempotent guard (if (cached_device_name.empty())). The sensor will return an empty string only before WiFi connects, after which it's populated on wifi.on_connect and the update_interval is set to never. This is a safe, intentional pattern for a diagnostic entity and requires no changes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (1)

142-149: Verify the integration of init_device_name_cache() and ensure cached_device_name is initialized before the first fire_ha_event() call.

The fire_ha_event() function and cached_device_name variable are properly declared and implemented in the component (lines 74-75 and 18 of tx_ultimate_easy_api.h), and the implementation correctly uses esphome::api::CustomAPIDevice to fire Home Assistant events.

However, there is a critical timing issue: cached_device_name is initialized in the WiFi on_connect handler (lines 355-367), which executes after the boot sequence. The api_send_ha_event_boot("start") script is called during on_boot at priority 700 (line 173), before WiFi connects and before cached_device_name is populated. This means the first boot event will be sent with an empty device_name field.

Recommendation: Initialize cached_device_name from App.get_name() during the on_boot sequence (e.g., in boot_initialize at priority 700) rather than deferring it to wifi.on_connect. This ensures the device name is available for all boot events.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9112901 and d21a36a.

📒 Files selected for processing (7)
  • .test/esphome_ard_hw_relays.yaml (1 hunks)
  • .test/esphome_ard_hw_speaker.yaml (1 hunks)
  • .test/esphome_ard_hw_vibration.yaml (1 hunks)
  • .test/esphome_idf_hw_relays.yaml (1 hunks)
  • .test/esphome_idf_hw_speaker.yaml (1 hunks)
  • .test/esphome_idf_hw_vibration.yaml (1 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (8 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.
📚 Learning: 2025-08-10T21:47:55.413Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.

Applied to files:

  • .test/esphome_idf_hw_vibration.yaml
  • .test/esphome_ard_hw_relays.yaml
  • .test/esphome_idf_hw_relays.yaml
  • .test/esphome_ard_hw_vibration.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-11T22:06:11.073Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.

Applied to files:

  • .test/esphome_ard_hw_relays.yaml
  • .test/esphome_idf_hw_relays.yaml
  • .test/esphome_ard_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2024-12-26T21:18:44.593Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 73
File: ESPHome/TX-Ultimate-Easy-ESPHome_addon_media_player.yaml:14-20
Timestamp: 2024-12-26T21:18:44.593Z
Learning: In the TX Ultimate Easy ESPHome setup, the i2s_dout_pin for audio output is defined in respective speaker or media_player components rather than in the core_hw_audio package.

Applied to files:

  • .test/esphome_ard_hw_relays.yaml
  • .test/esphome_idf_hw_relays.yaml
  • .test/esphome_ard_hw_vibration.yaml
  • .test/esphome_idf_hw_speaker.yaml
  • .test/esphome_ard_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-05T19:20:33.157Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:72-76
Timestamp: 2025-08-05T19:20:33.157Z
Learning: In the TX Ultimate Easy project, the `attr_light_output_1` global variable in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml is intentionally saved but not restored on boot because the restoration logic will be implemented in the hw_leds area in the near future. The `light_attributes_restore` script consumer is planned to be in the hw_relays area while the script itself remains in hw_leds as part of the ongoing storage optimization work.

Applied to files:

  • .test/esphome_ard_hw_relays.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2024-12-24T22:40:00.309Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 71
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml:20-21
Timestamp: 2024-12-24T22:40:00.309Z
Learning: The BLE addon uses a unique speaker component named mp_speaker and removes the media_player component entirely, so no rename from mp_speaker to mp_media_player is required there.

Applied to files:

  • .test/esphome_idf_hw_speaker.yaml
  • .test/esphome_ard_hw_speaker.yaml
📚 Learning: 2025-07-29T08:10:32.072Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 112
File: .github/workflows/validate_esphome_dev.yml:52-210
Timestamp: 2025-07-29T08:10:32.072Z
Learning: Media player functionality is now supported by both Arduino and IDF frameworks in TX Ultimate Easy ESPHome configurations, removing the previous Arduino-only limitation.

Applied to files:

  • .test/esphome_ard_hw_speaker.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-05T19:18:45.684Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:547-561
Timestamp: 2025-08-05T19:18:45.684Z
Learning: In the TX Ultimate Easy project's light_attributes_restore script in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml, the user intentionally chose to restore only brightness and RGB attributes without turning the light on. The design uses C++ lambdas instead of ESPHome YAML functions specifically to avoid automatically turning lights on during restoration, allowing users to manually control the on/off state while preserving visual settings.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-06T21:11:16.509Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1356-1358
Timestamp: 2025-08-06T21:11:16.509Z
Learning: In the TX Ultimate Easy project's relay light mode selectors in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, the fallback value for active_index().value_or(1) is intentionally set to 1, which corresponds to the first active light mode (Bottom for EU, Left for US) rather than 0 (Disabled). This ensures the default behavior maintains LED functionality rather than disabling lights on cold boot.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-07-09T22:37:04.600Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
🔇 Additional comments (7)
.test/esphome_idf_hw_relays.yaml (1)

5-5: Test file aligned with package rename.

This mirrors the corresponding change in .test/esphome_ard_hw_relays.yaml and maintains consistency across test variants (Arduino and IDF).

Verification of the include file path can be confirmed by the script from the Arduino test file review.

.test/esphome_ard_hw_relays.yaml (1)

5-5: File rename verified—the new include path resolves correctly.

The renamed file TX-Ultimate-Easy-ESPHome_hw_relays.yaml exists at ESPHome/ and is consistently referenced in both .test/esphome_ard_hw_relays.yaml and .test/esphome_idf_hw_relays.yaml. No orphaned references to the old standard_hw_relays naming remain in the test files.

.test/esphome_ard_hw_speaker.yaml (1)

5-5: Refactoring successfully completed; no issues found.

The renamed include file exists at ESPHome/TX-Ultimate-Easy-ESPHome_hw_speaker.yaml, there are no orphaned references to the old standard_hw_speaker_package key, and the only mention of the old file path is in a comment within TX-Ultimate-Easy-ESPHome_advanced.yaml (harmless). The new package is correctly referenced in related configuration files.

.test/esphome_idf_hw_vibration.yaml (1)

5-5: Target YAML file confirmed to exist.

The included file TX-Ultimate-Easy-ESPHome_hw_vibration.yaml exists at ESPHome/TX-Ultimate-Easy-ESPHome_hw_vibration.yaml. The include path is correctly configured and will resolve properly from the .test/ directory.

ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (3)

201-201: The extern declaration is properly in place and correctly scoped.

The verification confirms that esphome::tx_ultimate_easy::cached_device_name is:

  • Declared as extern std::string in the public header (components/tx_ultimate_easy/tx_ultimate_easy_api.h)
  • Defined and initialized in the implementation file (components/tx_ultimate_easy/tx_ultimate_easy_api.cpp)
  • Properly scoped within the esphome::tx_ultimate_easy namespace
  • Used correctly in the component's event firing logic

No issues found. The variable is accessible from the YAML custom component code and follows proper C++ extern patterns.


34-36: homeassistant_services: true is the correct flag to enable HA event emission.

Per ESPHome's official API documentation, this flag under the api: section correctly enables Home Assistant event/service support for C++ functions like fire_homeassistant_event() and call_homeassistant_service(). The flag defaults to false but is the only configuration required when using these functions (it is automatically enabled if using built-in homeassistant.service/homeassistant.event actions).


81-81: The min_version requirement for ESPHome 2025.11.0 is justified and necessary.

The project includes custom C++ components that define automation triggers (tx_ultimate_easy_touch with 7 custom Trigger<TouchPoint> instances) and Home Assistant event firing (tx_ultimate_easy_api). ESPHome 2025.11.0 (released November 19, 2025) introduced breaking changes to the trigger/action/condition framework and automation APIs. The custom triggers exposed via YAML automation (on_touch_event, on_press, on_release, on_swipe_left, on_swipe_right, on_multi_touch_release, on_long_touch_release) require compatibility with the updated automation framework. Additionally, the homeassistant_services: true setting and event firing rely on 2025.11.0's improved event processing. This version bump aligns with the feature requirements of the custom component architecture.

@edwardtfn edwardtfn linked an issue Dec 9, 2025 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
components/tx_ultimate_easy/tx_ultimate_easy_api.h (1)

1-1: Update the file comment to reflect actual purpose.

The comment states "Generic flag system" but this file provides the public API for Home Assistant event handling and device name caching.

-// tx_ultimate_easy_api.h - Generic flag system for TX Ultimate Easy
+// tx_ultimate_easy_api.h - Public API for TX Ultimate Easy component
components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (1)

17-30: Consider trimming trailing underscores.

If the raw device name ends with non-alphanumeric characters (e.g., "TX-Ultimate-Easy!"), the result will have a trailing underscore ("tx_ultimate_easy_"). While not critical, this could be cleaned up.

Apply this diff to trim trailing underscores:

     }
   }
+  // Remove trailing underscore if present
+  if (!cached_device_name.empty() && cached_device_name.back() == '_') {
+    cached_device_name.pop_back();
+  }
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f64d4e and 845ba20.

📒 Files selected for processing (3)
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (12 hunks)
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (1 hunks)
  • components/tx_ultimate_easy/tx_ultimate_easy_api.h (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.
📚 Learning: 2025-08-11T22:06:11.073Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.h
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-10T21:47:55.413Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.h
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-07-09T22:37:04.600Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.h
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2024-12-23T03:35:56.090Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 56
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml:18-147
Timestamp: 2024-12-23T03:35:56.090Z
Learning: The user clarified that the proposed YAML anchor refactoring approach will not work with ESPHome, and they intend to maintain the current implementation despite code duplication.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-05T19:20:33.157Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:72-76
Timestamp: 2025-08-05T19:20:33.157Z
Learning: In the TX Ultimate Easy project, the `attr_light_output_1` global variable in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml is intentionally saved but not restored on boot because the restoration logic will be implemented in the hw_leds area in the near future. The `light_attributes_restore` script consumer is planned to be in the hw_relays area while the script itself remains in hw_leds as part of the ongoing storage optimization work.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-05T19:18:45.684Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:547-561
Timestamp: 2025-08-05T19:18:45.684Z
Learning: In the TX Ultimate Easy project's light_attributes_restore script in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml, the user intentionally chose to restore only brightness and RGB attributes without turning the light on. The design uses C++ lambdas instead of ESPHome YAML functions specifically to avoid automatically turning lights on during restoration, allowing users to manually control the on/off state while preserving visual settings.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-07-29T08:10:32.072Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 112
File: .github/workflows/validate_esphome_dev.yml:52-210
Timestamp: 2025-07-29T08:10:32.072Z
Learning: Media player functionality is now supported by both Arduino and IDF frameworks in TX Ultimate Easy ESPHome configurations, removing the previous Arduino-only limitation.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2024-12-26T21:18:44.593Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 73
File: ESPHome/TX-Ultimate-Easy-ESPHome_addon_media_player.yaml:14-20
Timestamp: 2024-12-26T21:18:44.593Z
Learning: In the TX Ultimate Easy ESPHome setup, the i2s_dout_pin for audio output is defined in respective speaker or media_player components rather than in the core_hw_audio package.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
📚 Learning: 2025-08-06T21:11:16.509Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml:1356-1358
Timestamp: 2025-08-06T21:11:16.509Z
Learning: In the TX Ultimate Easy project's relay light mode selectors in ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_relays.yaml, the fallback value for active_index().value_or(1) is intentionally set to 1, which corresponds to the first active light mode (Bottom for EU, Left for US) rather than 0 (Disabled). This ensures the default behavior maintains LED functionality rather than disabling lights on cold boot.

Applied to files:

  • ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml
🧬 Code graph analysis (1)
components/tx_ultimate_easy/tx_ultimate_easy_api.h (1)
components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (4)
  • initialize_cached_device_name (17-30)
  • initialize_cached_device_name (17-17)
  • fire_ha_event (33-55)
  • fire_ha_event (33-33)
🪛 Cppcheck (2.18.0)
components/tx_ultimate_easy/tx_ultimate_easy_api.cpp

[information] 4-4: Include file

(missingInclude)


[information] 5-5: Include file

(missingInclude)


[information] 6-6: Include file

(missingInclude)


[information] 7-7: Include file

(missingInclude)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 9-9: Include file

(missingIncludeSystem)


[information] 10-10: Include file

(missingIncludeSystem)


[information] 3-3: Include file

(missingInclude)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ Arduino Core (latest)
🔇 Additional comments (16)
components/tx_ultimate_easy/tx_ultimate_easy_api.h (3)

16-39: LGTM!

The cached device name approach and initialization function are well-documented and correctly declared.


41-71: LGTM!

The watchdog utility function is well-implemented with clear documentation about its blocking behavior and appropriate usage patterns.


73-92: LGTM!

The event firing API is well-designed. Taking the data map by value allows the function to inject core fields without modifying the caller's map, which is the correct approach.

components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (2)

5-7: LGTM! The stringification fix is correctly applied.

The STRINGIFY macros correctly handle the firmware version macro, converting numeric versions like "9999.99.9" to string literals at compile time. This resolves the previous compilation error.

Based on learnings and past review resolution.


32-55: LGTM!

The event firing implementation correctly uses the CustomAPIDevice pattern and properly stringifies the firmware version. The structured logging with conditional verbosity is well-implemented.

Based on learnings: ESPHome event firing pattern is correct.

ESPHome/TX-Ultimate-Easy-ESPHome_common.yaml (11)

76-79: Verify ESP32 advanced framework settings are compatible.

The changes introduce loop_task_stack_size: 16384 and sdkconfig_options within the advanced section. Confirm these settings are supported in ESPHome 2025.11.0 and don't conflict with esp-idf framework configuration.


91-92: Confirm TX_ULTIMATE_EASY_FIRMWARE_VERSION build flag is used in C++.

The new build flag TX_ULTIMATE_EASY_FIRMWARE_VERSION="${version}" is defined but not directly used in this YAML file. Verify it's consumed by the C++ component (likely in preprocessor conditionals or logging macros).


185-189: Good use of current_option() instead of indexed access.

The change from accessing via index to current_option() is correct for template select components and improves clarity. The logic for detecting US model format is sound.


282-290: Device name initialization via single-mode script is sound.

The update_device_name script uses mode: single, ensuring the initialization runs only once even if WiFi connects/reconnects. The dependency on initialize_cached_device_name() being idempotent (checks empty()) is appropriate. This follows the previous review feedback to move sanitization logic to C++.


359-368: WiFi on_connect flow for device name and version initialization looks correct.

The on_connect handler publishes the firmware version and executes the single-mode update_device_name script. Since update_device_name guards against re-execution with the empty() check, this flow is safe even across WiFi reconnects.

Verify that the script execution order (publish tx_fw_version before update_device_name) does not cause any race conditions when WiFi reconnects occur in rapid succession.


14-32: TAG substitution rename is consistently applied.

All references from TAG_CORE_COMMON to TAG_COMMON are present throughout logging statements. The substitution definition on line 32 is clear.


203-241: Logging now correctly uses cached_device_name and updated TAG.

The dump_config script now logs cached_device_name via the C++ cache (line 206) instead of deriving it from YAML. All logging uses the updated TAG_COMMON substitution. This is an improvement over the previous approach.


282-290: The C++ component properly exports both cached_device_name and initialize_cached_device_name(). The global is declared as extern std::string cached_device_name in the header and defined in the implementation. The function is properly declared and implemented with initialization guards. No changes needed.


36-36: Remove the verification request—homeassistant_services: true is supported in ESPHome 2025.11.0.

The homeassistant_services option is a valid boolean setting under the api: configuration in ESPHome 2025.11.0 and is properly configured in your example. It defaults to false and is automatically enabled when using homeassistant.service or homeassistant.event actions, but can be set manually to explicitly compile Home Assistant service-call support.


153-153: No action required. The fire_ha_event() function is properly implemented in the tx_ultimate_easy component with the correct signature and is correctly called from the YAML lambda. The function exists at components/tx_ultimate_easy/tx_ultimate_easy_api.cpp:33-55 with signature void fire_ha_event(const std::string &domain, const std::string &type, std::map<std::string, std::string> data = {}), and it correctly uses esphome::api::CustomAPIDevice to fire Home Assistant events, following the ESPHome best practice pattern.


85-85: All features are properly supported and implemented.

Verification confirms:

  • homeassistant_services: true is supported in ESPHome 2025.11.0 (available since 2025.8.0)
  • fire_ha_event() function is properly exported with correct signature matching the YAML usage
  • initialize_cached_device_name() is implemented with documented behavior
  • cached_device_name is declared as a module-level global string
  • ESP32 advanced settings (loop_task_stack_size, sdkconfig_options) are standard ESPHome features
  • TX_ULTIMATE_EASY_FIRMWARE_VERSION build flag is correctly used in the component

The min_version bump to 2025.11.0 is justified and all APIs are compatible with this version.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e85508 and c531f02.

📒 Files selected for processing (1)
  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.
📚 Learning: 2025-07-09T22:37:04.600Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 111
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:121-129
Timestamp: 2025-07-09T22:37:04.600Z
Learning: In ESPHome, to fire Home Assistant events from C++ lambda functions, the correct approach is to create a stack variable of type `esphome::api::CustomAPIDevice` and call `fire_homeassistant_event()` on it, not to use the API server component directly.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
📚 Learning: 2025-08-11T22:06:11.073Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml:42-45
Timestamp: 2025-08-11T22:06:11.073Z
Learning: In the TX Ultimate Easy project, temporary external component references to unmerged PRs (like `github://pr#10195`) are intentionally used during development in ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml and will be updated or removed before release.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
📚 Learning: 2025-08-10T21:47:55.413Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 120
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_common.yaml:112-119
Timestamp: 2025-08-10T21:47:55.413Z
Learning: In the TX Ultimate Easy project, when using ESPHome external components with `ref: v${version}`, the version comes directly from VERSION_YAML without any prefix. Development versions (like 2025.8.2dev) won't have corresponding tags until release, but ESPHome handles this gracefully during development builds.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
📚 Learning: 2024-12-23T03:35:56.090Z
Learnt from: edwardtfn
Repo: edwardtfn/TX-Ultimate-Easy PR: 56
File: ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml:18-147
Timestamp: 2024-12-23T03:35:56.090Z
Learning: The user clarified that the proposed YAML anchor refactoring approach will not work with ESPHome, and they intend to maintain the current implementation despite code duplication.

Applied to files:

  • components/tx_ultimate_easy/tx_ultimate_easy_api.cpp
🪛 Cppcheck (2.18.0)
components/tx_ultimate_easy/tx_ultimate_easy_api.cpp

[information] 4-4: Include file

(missingInclude)


[information] 5-5: Include file

(missingInclude)


[information] 6-6: Include file

(missingInclude)


[information] 7-7: Include file

(missingInclude)


[information] 8-8: Include file

(missingIncludeSystem)


[information] 9-9: Include file

(missingIncludeSystem)


[information] 10-10: Include file

(missingIncludeSystem)


[information] 3-3: Include file

(missingInclude)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ Arduino Core (dev)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ IDF Core (latest)
  • GitHub Check: 🏗️ IDF Core (dev)
  • GitHub Check: 🏗️ Arduino Core (latest)
  • GitHub Check: 🏗️ Arduino Core (dev)
🔇 Additional comments (2)
components/tx_ultimate_easy/tx_ultimate_easy_api.cpp (2)

5-7: STRINGIFY macros correctly implemented.

The two-level macro expansion pattern properly converts the firmware version to a string literal at compile time, handling versions with dots correctly.


51-52: Correct ESPHome event firing pattern.

The implementation correctly uses a stack-allocated CustomAPIDevice to fire Home Assistant events, which aligns with ESPHome best practices.

Based on learnings, this is the correct approach for firing HA events from C++.

@edwardtfn edwardtfn merged commit 2c49611 into main Dec 9, 2025
53 checks passed
@edwardtfn edwardtfn deleted the code-update branch December 9, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swipe Gestures up is down, down is up

1 participant