txt replacing text

This commit is contained in:
Edward Firmo
2024-02-18 17:49:44 +01:00
parent e394151369
commit 92585eb06e
2 changed files with 6 additions and 6 deletions

View File

@@ -197,14 +197,14 @@ Ideal for user interfaces that require real-time text updates, such as status me
**Parameters:** **Parameters:**
- `id` (string): Identifier of the component whose text will be updated. Ensure this matches the component's ID in your display layout. - `id` (string): Identifier of the component whose text will be updated. Ensure this matches the component's ID in your display layout.
- `text` (string): The new text content to display. This can include static text or dynamic information passed at runtime. - `txt` (string): The new text content to display. This can include static text or dynamic information passed at runtime.
**Home Assistant Example:** **Home Assistant Example:**
```yaml ```yaml
service: esphome.<your_panel_name>_component_text service: esphome.<your_panel_name>_component_text
data: data:
id: "home.time" id: "home.time"
text: "12:34" txt: "12:34"
``` ```
> [!NOTE] > [!NOTE]
> Replace `<your_panel_name>` with your specific panel name as configured in Home Assistant to ensure correct service execution. > Replace `<your_panel_name>` with your specific panel name as configured in Home Assistant to ensure correct service execution.

View File

@@ -352,24 +352,24 @@ api:
# #
# Parameters: # Parameters:
# - id (string): Identifier of the component. Ensure it matches the component's ID in your display layout. # - id (string): Identifier of the component. Ensure it matches the component's ID in your display layout.
# - text (string): New text content to be displayed. Supports both static and dynamic content. # - txt (string): New text content to be displayed. Supports both static and dynamic content.
# #
# Example service call: # Example service call:
# service: esphome.<your_panel_name>_component_text # service: esphome.<your_panel_name>_component_text
# data: # data:
# id: "home.time" # Component ID to update. Match this with your display's component ID. # id: "home.time" # Component ID to update. Match this with your display's component ID.
# text: "12:34" # New text content to display. # txt: "12:34" # New text content to display.
# #
# NOTE: Replace <your_panel_name> with your specific panel name in your Home Assistant setup. # NOTE: Replace <your_panel_name> with your specific panel name in your Home Assistant setup.
# Ensure 'id' accurately targets the correct component for the text update to be successful. # Ensure 'id' accurately targets the correct component for the text update to be successful.
- service: component_text - service: component_text
variables: variables:
id: string id: string
text: string txt: string
then: then:
- lambda: |- - lambda: |-
if (!id(is_uploading_tft)) if (!id(is_uploading_tft))
disp1->set_component_text_printf(id.c_str(), "%s", text.c_str()); disp1->set_component_text_printf(id.c_str(), "%s", txt.c_str());
# Component Value Service # Component Value Service
# This service updates the numerical value of a specified component on the display, # This service updates the numerical value of a specified component on the display,