Fix current_brightness name conflict
This commit is contained in:
@@ -153,9 +153,9 @@ script:
|
|||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
ESP_LOGD("script.set_brightness(custom)", "brightness: %i%%", brightness);
|
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));
|
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_brightness: %i%%", current_brightness);
|
ESP_LOGV("script.set_brightness(custom)", "current_light_brightness: %i%%", current_light_brightness);
|
||||||
if (brightness != current_brightness) {
|
if (brightness != current_light_brightness) {
|
||||||
if (current_page->state != "screensaver" and brightness > 0) {
|
if (current_page->state != "screensaver" and brightness > 0) {
|
||||||
auto call = display_light->turn_on();
|
auto call = display_light->turn_on();
|
||||||
call.set_brightness(static_cast<float>(current_brightness->state) / 100.0f);
|
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.
|
Bug fixes and minor enhancements.
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!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)
|
> **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);`
|
> 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`.
|
||||||
> 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.
|
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.
|
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:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
ESP_LOGD("script.set_brightness(custom)", "brightness: %i%%", brightness);
|
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));
|
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_brightness: %i%%", current_brightness);
|
ESP_LOGV("script.set_brightness(custom)", "current_light_brightness: %i%%", current_light_brightness);
|
||||||
if (brightness != current_brightness) {
|
if (brightness != current_light_brightness) {
|
||||||
if (current_page->state != "screensaver" and brightness > 0) {
|
if (current_page->state != "screensaver" and brightness > 0) {
|
||||||
auto call = display_light->turn_on();
|
auto call = display_light->turn_on();
|
||||||
call.set_brightness(static_cast<float>(current_brightness->state) / 100.0f);
|
call.set_brightness(static_cast<float>(current_brightness->state) / 100.0f);
|
||||||
@@ -401,6 +401,7 @@ script:
|
|||||||
call.perform();
|
call.perform();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Scheduled actions
|
### Scheduled actions
|
||||||
|
|||||||
Reference in New Issue
Block a user