Replace deprecated global display_last_brightness on "Set display as a light"

This commit is contained in:
Edward Firmo
2024-01-17 02:04:42 +01:00
parent ccf139fa5f
commit 9a761dbc71
3 changed files with 7 additions and 2 deletions

View File

@@ -158,7 +158,7 @@ script:
if (brightness != current_brightness) {
if (current_page->state != "screensaver" and brightness > 0) {
auto call = display_light->turn_on();
call.set_brightness(static_cast<float>(id(display_last_brightness)) / 100.0f);
call.set_brightness(static_cast<float>(current_brightness->state) / 100.0f);
call.perform();
} else if (display_light->current_values.is_on()) {
auto call = display_light->turn_off();

View File

@@ -366,6 +366,11 @@ Your feedback and support are crucial to our continuous improvement.
## Patch v4.2.3
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<float>(id(display_last_brightness)) / 100.0f);` to `call.set_brightness(static_cast<float>(current_brightness->state) / 100.0f);`
> as that global variable was replaced by a new sensor.
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.

View File

@@ -393,7 +393,7 @@ script:
if (brightness != current_brightness) {
if (current_page->state != "screensaver" and brightness > 0) {
auto call = display_light->turn_on();
call.set_brightness(static_cast<float>(id(display_last_brightness)) / 100.0f);
call.set_brightness(static_cast<float>(current_brightness->state) / 100.0f);
call.perform();
} else if (display_light->current_values.is_on()) {
auto call = display_light->turn_off();