Fix current_brightness name conflict
This commit is contained in:
@@ -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<float>(current_brightness->state) / 100.0f);
|
||||
|
||||
@@ -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<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.
|
||||
> **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.
|
||||
|
||||
@@ -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<float>(current_brightness->state) / 100.0f);
|
||||
@@ -401,6 +401,7 @@ script:
|
||||
call.perform();
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Scheduled actions
|
||||
|
||||
Reference in New Issue
Block a user