From c97be551c0a782609d45d418aa3acaa15331f1ab Mon Sep 17 00:00:00 2001
From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com>
Date: Mon, 18 Dec 2023 12:11:57 +0100
Subject: [PATCH] Enhanced control for automation entities on buttons
Solves #1291
Solves #810
Solves #1249
Solves #1291
Solves #320
Solves #331
---
ReleaseNotes.md | 42 +++++++++++++++++++++++++++++++++++-------
nspanel_blueprint.yaml | 22 +++++++++++++++++++++-
2 files changed, 56 insertions(+), 8 deletions(-)
diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index e43a731..bc2af62 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -31,9 +31,9 @@ Updates may come with changes on the blueprint inputs and we highly recommend yo
## Breaking changes
-1. The `background` parameter in the `esphome.xxxxx_set_component_color` service is now deprecated.
-2. With the introduction of additional custom buttons, the layout of other buttons on the home page has been adjusted.
-3. Wi-Fi power save mode has been reset to `NONE` as the default setting.
This was the standard up to v4.0. We switched it in v4.1 to accommodate Bluetooth components. However, since this feature isn't widely used, we're reverting to the original setting. For Bluetooth usage, you should manually set a different mode, such as `LIGHT`, as shown in the customization example below:
+1. **The `background` parameter in the `esphome.xxxxx_set_component_color` service is now deprecated.**
+2. With the introduction of additional custom buttons, the **layout of other buttons on the home page has been adjusted**.
+3. **Wi-Fi power save mode has been reset to `NONE` as the default setting.**
This was the standard up to v4.0. We switched it in v4.1 to accommodate Bluetooth components. However, since this feature isn't widely used, we're reverting to the original setting. For Bluetooth usage, you should manually set a different mode, such as `LIGHT`, as shown in the customization example below:
```yaml
##### My customization - Start #####
# Enable Bluetooth proxy
@@ -43,10 +43,22 @@ wifi:
power_save_mode: LIGHT
##### My customization - End #####
```
-4. The default baud rate for advanced mode has been reverted to 115200 bps to resolve issues that arise when rendering button pages.
-5. ESPHome v2023.12.0 has been established as the minimum required version to ensure optimal performance and compatibility, particularly with the recent developments in the Nextion component.
-6. The Alarm section in the blueprint settings has been removed. All configurations previously made in this section have been automatically transferred to custom button 07.
-7. Documentation in German is no longer maintained. This change allows us to more efficiently update and maintain the remaining documentation.
+4. **The default baud rate for advanced mode has been reverted to 115200 bps** to resolve issues that arise when rendering button pages.
+5. **ESPHome v2023.12.0 has been established as the minimum required version** to ensure optimal performance and compatibility, particularly with the recent developments in the Nextion component.
+6. **The Alarm section in the blueprint settings has been removed.** All configurations previously made in this section have been automatically transferred to custom button 07.
+7. **Documentation in German is no longer maintained.** This change allows us to more efficiently update and maintain the remaining documentation.
+8. **Reversion to "Toggle" as default action for automation entities on buttons.**
+
+ In this update, we have reverted the default action for button presses on automation. entities back to "Toggle." This change reverses the adjustment made in version 4.1, where "Trigger" was set as the default action.
+
+ **Impact:**
+
+ - **Default Behavior:** With this reversion, pressing a button linked to an automation entity will now enable or disable the automation, as it did prior to version 4.1.
+ - **Consistency and Familiarity:** This change aims to align with user expectations and maintain consistency in the user experience.
+ - **Customization Still Available:** Users still have the option to manually set "Trigger" as the action for their automation. entities, as per their preference.
+
+ We understand that changes in default settings can impact your workflows. We appreciate your understanding as we strive to balance new features with the familiarity and stability of the user experience.
+9.
## Overview of noteworthy changes
@@ -61,6 +73,7 @@ wifi:
9. Home page chips now supports covers
10. Chips can be inverted
11. Add swipe control to screensaver page
+12. Enhanced control for automation entities on buttons
## Details of noteworthy changes
@@ -130,6 +143,21 @@ Chips now have an 'invert' option on the blueprint settings, providing additiona
### 11. Add swipe control to Screensaver page
You can now navigate to button pages from the screensaver while your panel is in sleep mode. The swipe controls will function as they do on the Home page.
+
+### 12. Enhanced control for automation entities on buttons
+We're pleased to announce a new feature that offers users enhanced control over their smart home setups. Now, you can globally select between **Toggle** and **Trigger** actions for button presses on automation entities. This update allows for a more personalized and efficient control experience, tailored to your unique preferences.
+
+#### Key features:
+- **Toggle:** This action will enable or disable the automation. It is set as the default option.
+- **Trigger:** This action will execute the automation regardless of its current state, providing more flexibility.
+
+#### How to use:
+1. Access your configuration for automation under **Services** > **Automations & Scenes**. Select the automation associated with your panel setup.
+1. Scroll to the **ADVANCED SETTINGS** section at the end.
+1. From the menu, select your desired action - either **Toggle** or **Trigger**.
+1. Apply the setting. This will then be effective across all relevant entities.
+
+This update is specially designed to cater to diverse user needs, ensuring a more intuitive and responsive smart home experience.
## What's Next?
Discover what's next and what we are working on right now in our [Milestones](https://github.com/Blackymas/NSPanel_HA_Blueprint/milestones?direction=asc&sort=due_date)
diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml
index cf54a9c..86dd13c 100644
--- a/nspanel_blueprint.yaml
+++ b/nspanel_blueprint.yaml
@@ -3747,6 +3747,25 @@ blueprint:
min: 0
max: 5000
unit_of_measurement: milliseconds
+ domain_automation_button_action:
+ name: Button action for automation entities
+ description: >
+ *SYSTEM settings*
+
+ *Select the button action when associated to `automation.xxx` entities.*
+
+ ***Toggle:** Enable/disable the automation (default).*
+
+ ***Trigger:** Run the automation (ignoring conditions).*
+ default: "toggle"
+ selector:
+ select:
+ multiple: false
+ options:
+ - label: "Toggle (default)"
+ value: "toggle"
+ - label: "Trigger"
+ value: "trigger"
# yamllint enable rule:line-length
#############################################################
@@ -6047,6 +6066,7 @@ variables:
embedded_climate: '{{ climate == thermostat_embedded }}'
indoor_temperature_sensor: !input 'indoortemp'
embedded_indoor_temperature: '{{ indoor_temperature_sensor == nspaneltemp or not (indoor_temperature_sensor is string and indoor_temperature_sensor is match "sensor.")}}'
+ domain_automation_button_action: !input domain_automation_button_action
enum:
color_mode: # Possible light color modes. - https://github.com/home-assistant/core/blob/dev/homeassistant/components/light/__init__.py
@@ -9251,7 +9271,7 @@ action:
{% elif entity_domain in ["light", "switch", "cover", "input_boolean", "fan", "remote"] %}
{{ entity_domain }}.toggle
{% elif entity_domain in ["automation"] %}
- {{ entity_domain }}.trigger
+ {{ entity_domain }}.{{ domain_automation_button_action if domain_automation_button_action is string else "toggle"}}
{% elif entity_domain in ["button", "input_button"] %}
{{ entity_domain }}.press
{% elif entity_domain in ["scene", "script"] %}