Disable all services while upload

A service call still possible, but the services won't do anything.
Helps with #1946
This commit is contained in:
Edward Firmo
2024-03-22 11:21:50 +01:00
parent dbf57053db
commit d2b924b355

View File

@@ -248,11 +248,13 @@ api:
visible: bool # Set to true to show the component, or false to hide it.
then:
- lambda: |-
if (!id(is_uploading_tft)) {
for (const std::string& component_id : ids) {
if (!id(is_uploading_tft) and !component_id.empty()) {
set_component_visibility->execute(component_id.c_str(), visible);
}
}
}
# Displays detailed information for a specific entity.
- service: entity_details_show
@@ -280,6 +282,7 @@ api:
state: bool # State for the button(s) indication: true for active, false for inactive
then:
- lambda: |-
if (!id(is_uploading)) {
// Updates the visual state indication for hardware buttons
// Use bitwise AND to check specific bits
if (button_mask & 1) // Checks if the least significant bit is set (left button)
@@ -288,6 +291,7 @@ api:
update_bitwise_setting(id(buttons_settings), state, ButtonSettings::ButtonRight_State);
// Refreshes the indication bars on the display
refresh_hardware_buttons_bars->execute(button_mask);
}
# Icon Service
- service: icon
@@ -316,6 +320,10 @@ api:
screensaver_time_font: int # Specifies the font id for the screensaver time display.
screensaver_time_color: int[] # RGB color for the screensaver time display, e.g., [165, 42, 42] for reddish-brown.
decimal_separator: string # The char to be used as decimal separator.
then:
- if:
condition:
- lambda: return (!id(is_uploading));
then:
- script.execute:
id: global_settings
@@ -349,6 +357,10 @@ api:
embedded_climate: bool # Indicates if climate control is integrated.
embedded_climate_friendly_name: string # Friendly name for the climate control feature.
embedded_indoor_temperature: bool # Enables indoor temperature display.
then:
- if:
condition:
- lambda: return (!id(is_uploading));
then:
- script.execute:
id: init_hardware_climate
@@ -402,6 +414,7 @@ api:
refresh_hardware_buttons_bars->execute(3);
}
blueprint_status->publish_state(int(blueprint_status->raw_state) | (1 << 4));
# Sets up the "Home" page in ESPHome with customized settings and UI elements as defined in the project blueprint.
- service: init_page_home
variables:
@@ -503,11 +516,13 @@ api:
- service: notification_clear
then:
- lambda: |-
if (!id(is_uploading)) {
if (current_page->state == "notification") goto_page->execute("home");
notification_label->publish_state("");
notification_text->publish_state("");
notification_unread->turn_off();
set_component_visibility->execute("home.bt_notific", false);
}
# Displays a notification message on the screen, useful for alerts or informational updates.
- service: notification_show
@@ -772,8 +787,7 @@ api:
variables:
tone: string # The RTTTL string for the melody to be played. It should follow the RTTTL format, including the melody's name, default settings, and a sequence of notes.
then:
- rtttl.play:
rtttl: !lambda return tone;
- lambda: if (!id(is_uploading_tft)) buzzer->play(tone);
# Updates an entity to display specific values with dynamic icons, names, and color codes.
- service: value