diff --git a/.test/esphome_advanced_climate_heat_customizations.yaml b/.test/esphome_advanced_climate_heat_customizations.yaml index 1a5db65..a8d2d96 100644 --- a/.test/esphome_advanced_climate_heat_customizations.yaml +++ b/.test/esphome_advanced_climate_heat_customizations.yaml @@ -153,9 +153,9 @@ script: then: - lambda: |- ESP_LOGD("script.set_brightness(custom)", "brightness: %i%%", brightness); - uint8_t current_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0)); - ESP_LOGV("script.set_brightness(custom)", "current_brightness: %i%%", current_brightness); - if (brightness != current_brightness) { + uint8_t current_light_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0)); + ESP_LOGV("script.set_brightness(custom)", "current_light_brightness: %i%%", current_light_brightness); + if (brightness != current_light_brightness) { if (current_page->state != "screensaver" and brightness > 0) { auto call = display_light->turn_on(); call.set_brightness(static_cast(current_brightness->state) / 100.0f); diff --git a/ReleaseNotes.md b/ReleaseNotes.md index bf503a1..680d560 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -367,9 +367,8 @@ Your feedback and support are crucial to our continuous improvement. Bug fixes and minor enhancements. > [!IMPORTANT] -> **Breaking Change**: If you are using the [Customization "Set display as a light"](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md#set-display-as-a-light) -> please change the line `call.set_brightness(static_cast(id(display_last_brightness)) / 100.0f);` to `call.set_brightness(static_cast(current_brightness->state) / 100.0f);` -> as that global variable was replaced by a new sensor. +> **Breaking Change**: If you are using the [Customization "Set display as a light"](https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md#set-display-as-a-light), +> please update the code related to the extension to `script`/`set_brightness` as the global variable `display_last_brightness` was replaced by the new sensor `current_brightness`. We encourage all users to update their components to this latest version for the best experience. While this update is compatible with existing v4.2 components, it offers optimized performance and usability when fully updated. diff --git a/docs/customization.md b/docs/customization.md index 49e3c2d..8047bbf 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -388,9 +388,9 @@ script: then: - lambda: |- ESP_LOGD("script.set_brightness(custom)", "brightness: %i%%", brightness); - uint8_t current_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0)); - ESP_LOGV("script.set_brightness(custom)", "current_brightness: %i%%", current_brightness); - if (brightness != current_brightness) { + uint8_t current_light_brightness = int(round(display_light->current_values.is_on() ? (display_light->current_values.get_brightness() * 100.0f) : 0.0)); + ESP_LOGV("script.set_brightness(custom)", "current_light_brightness: %i%%", current_light_brightness); + if (brightness != current_light_brightness) { if (current_page->state != "screensaver" and brightness > 0) { auto call = display_light->turn_on(); call.set_brightness(static_cast(current_brightness->state) / 100.0f); @@ -401,6 +401,7 @@ script: call.perform(); } } + ``` ### Scheduled actions