hw_button_state service to control buttons individually

Solves #1934
This commit is contained in:
Edward Firmo
2024-03-19 11:13:55 +01:00
parent f28a02fd5d
commit cc756fda35
5 changed files with 65 additions and 23 deletions

View File

@@ -254,26 +254,27 @@ data:
> This setup provides a direct and user-friendly way to access and return from detailed entity information, enhancing the interface's usability.
### Hardware Button State Indication Service: `hw_button_state`
Updates the on-screen indication bars for the hardware buttons, reflecting the current state of the entities they control.
This service dynamically updates the on-screen indication bars for the hardware buttons, reflecting the current state of the entities they control.
It's designed to provide immediate visual feedback, enhancing the user interface by showing the active/inactive state of the left and right hardware button indicators on the panel.
**Usage:**
This service updates the visual state (on/off) of the left and right hardware button indicators on the panel.
It's used to provide visual feedback corresponding to the state of the entities controlled by these hardware buttons.
**Usage:**
Utilize this service to modify the visual state (on/off) of hardware button indicators on the panel, corresponding to the state of entities controlled by these buttons.
This allows for visual feedback that matches the operational state of the buttons.
**Parameters:**
- `left` (bool): The state to set for the left button's indication bar.
- `right` (bool): The state to set for the right button's indication bar.
**Parameters:**
- `button_mask` (int): A bitwise identifier for buttons. Use `1` for the left button, `2` for the right button, and `3` for both buttons.
- `state` (bool): The state to apply to the button(s) indicated by `button_mask`. True for on (active), false for off (inactive).
**Home Assistant Example:**
```yaml
service: esphome.<your_panel_name>_hw_button_state
data:
left: true # Turns the left button's indication bar on
right: false # Turns the right button's indication bar off
button_mask: 3 # Targets both the left (1) and right (2) buttons
state: true # Turns the indication bars on for both buttons
```
> [!NOTE]
> Replace `<your_panel_name>` with your specific panel name as configured in Home Assistant.
> This service dynamically updates the hardware button state indications, enhancing the user interface by providing immediate visual feedback.
> This service leverages a bitmask (`button_mask`) for flexible control over multiple hardware buttons simultaneously, offering a streamlined method for updating their visual states.
### Icon Service: `icon`
Updates a chip or custom button's icon, color, and visibility within Home Assistant.

View File

@@ -3,7 +3,8 @@
<!-- markdownlint-disable MD013 MD033 -->
| NSPanel_HA_Blueprint<br><sub><sup>Version</sup></sub> | Home Assistant<br><sub><sup>Min version</sup></sub> | ESPHome<br><sub><sup>Min version</sup></sub> |
| :--: | :--: | :--: |
| v4.3 | 2024.3.0 | 2023.12.0 |
| v4.3.1 | 2024.3.0 | 2024.3.0 |
| v4.3.0 | 2024.3.0 | 2023.12.0 |
| v4.2.2+ | 2023.12.0 | 2023.12.0 |
| v4.2.1<br>v4.2 | 2023.9.0 | 2023.12.0 |
| v4.1 | 2023.9.0 | 2023.5.0 |