There is also a slider on the display of the device
- slider:
x: 55
y: 135
id: settings_display_brightness
min_value: 1
max_value: 100
#internal: false
on_value:
- light.turn_on:
id: backlight
brightness: !lambda |-
return x / 100.0; // output value must be in range 0 - 1.0
- lvgl.label.update:
id: settings_display_brightness_label
text:
format: "%.0f%%"
args: [ x ]
- label:
x: 330
y: 125
text_font: roboto24
text_color: 0xCCCCCC
text: "N/A"
id: settings_display_brightness_label
Dragging the slider here will set the display’s backlight brightness without issue but how would I go about updating the slider if the backlight brightness has been adjusted from Home Assistant?
I missed the attributes: brightness which you had included in yours.
That sorta fixes it now, except I can’t adjust the slider now because I have the update on_value and not on_release for responsiveness. But I’m sure I can sort that out somehow. (One updates the other and the other updates the original and it goes round and round and round)
If anyone has a way to access these values directly instead of making a round trip through HA though I’d still be interested in hearing it. But at least it works now (or shortly).
I’m not sure if I follow you anymore…
Anyway, if you need to keep two sliders (and the output) in synch, some traffic there will be.
It’s just a question what is the path.
So in this case I’m trying to control the brightness of a display running esphome. This brightness should be controllable from HA as well as on the device itself via a slider.
If the brightness is set from HA, the slider should be updated to display the new brightness level. Instead, as at now, the brightness is set from HA, then the sensor pulls the brightness data a 2nd time to update the slider.
Ideally, this slider would follow the actual brightness of the light component, as opposed to having to call back to HA to get a value.
The method you proposed (to make that 2nd call to HA) is a method I tried previously with no luck but that was due to my error. But I am still looking for a more direct method