Skip to content

Slider does not update for brightness if adjusted outside of the card after being adjusted in the card #1367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
StaleLoafOfBread opened this issue Mar 27, 2025 · 13 comments
Labels
bug Something isn't working Bug-Fix 🥳

Comments

@StaleLoafOfBread
Copy link
Contributor

StaleLoafOfBread commented Mar 27, 2025

Describe the bug
Slider does not update for brightness if adjusted outside of the card after being adjusted in the card

To Reproduce
Steps to reproduce the behavior:

  1. Create a button slider card attached to a light
  2. Adjust the brightness via the card
  3. Adjust the brightness outside of the card
  4. Observe that the slider does not update

Expected behavior
The slider should update. In my screenshot the slider should fill up the bar. This expected behavior does occur if you do not adjust the brightness via the card before adjusting outside of the card.

Screenshots

Image

YAML
If applicable, add any relevant YAML code.

Your code here

Informations (please complete the following information):

  • OS: [e.g. iOS]
  • Browser/App: [e.g. chrome, safari]
  • Bubble Card version: v2.5.0-beta.9
  • Home Assistant version: [e.g. 2024.6.4]

Additional context
Add any other context about the problem here.

Thank you! 🍻

@StaleLoafOfBread StaleLoafOfBread added the bug Something isn't working label Mar 27, 2025
@Clooos
Copy link
Owner

Clooos commented Mar 28, 2025

Hi and thank again for the feedback! I will check that!

@AlexDaniel
Copy link
Contributor

@StaleLoafOfBread does the value update if you keep moving the mouse outside the card?

I'm not really able to reproduce it the way it's described, but it's very possible that it's related to this fix: #1395

Basically, if you have live updates on, you move the mouse (e.g. outside the card) and stop the mouse movement, the value will not update, as the last mouse move updates are throttled and the value does not update.

@StaleLoafOfBread
Copy link
Contributor Author

@AlexDaniel By "outside of the card" I meant adjusting it not via the card but rather another card, service call, automation, etc. Additional info below:

  1. Create a button slider card attached to a light
type: custom:bubble-card
card_type: button
modules:
  - default
button_type: slider
entity: light.living_room
  1. Adjust the light's brightness via the card

Image

  1. Adjust the brightness not via the card

Image

  1. Observe how the the card's visuals for the brightness did not update.

@AlexDaniel
Copy link
Contributor

Ahhhh, you're right! Sorry for not getting it right away. I was able to reproduce it, will take a look later.

AlexDaniel added a commit to AlexDaniel/Bubble-Card that referenced this issue Apr 14, 2025
While I'm not following the logic in that code path, the idea seems to
be that it should do an early return if the new value was not processed
yet.

And all that is fine, except that it was using `last_changed` instead of
`last_updated`. For lights, it means that it only reacted to lights
being turned on or off, not when the brightness was changing.

Resolves Clooos#1367.
@AlexDaniel
Copy link
Contributor

OK, the fix for lights is right here: #1400
I'm a bit confused with the difference between last_changed and last_updated, and how it affects other usages of the slider, so I don't know if there are any downsides to that fix.

@StaleLoafOfBread
Copy link
Contributor Author

StaleLoafOfBread commented Apr 15, 2025

@AlexDaniel Funnily enough, I am the one who added last_updated support in #1289 as an attribute (unrelated to the slider code).

That PR has more info that might help clear up the differences but basically last_changed is when the value actually changed last but last_updated is when the value was last refreshed. Sometimes, sensors will recheck their values and the value is the same as it was before. This would cause last_updated to change but not last_changed.

For example, lets say you had a sensor whose value is the current hour. Let's assume this sensor checks the current hour every minute. That sensor's last_changed value will only update once an hour but it's last_updated value will change every minute.

@AlexDaniel
Copy link
Contributor

@StaleLoafOfBread but is that connected to the attributes? If I get it right, when we change the brightness of a light, the main state (on/off) does not change. So, naturally last_changed will remain the same. Am I correct?

@StaleLoafOfBread
Copy link
Contributor Author

@AlexDaniel last_updated updates on attribute changes but last_changed does not.

Image

{{ states['light.living_room'].state }}
{{ states['light.living_room'].attributes.brightness }}
{{ states['light.living_room'].last_changed }}
{{ states['light.living_room'].last_updated }}

@StaleLoafOfBread
Copy link
Contributor Author

@AlexDaniel Not sure if its helpful but I just learned of last_reported https://developers.home-assistant.io/blog/2024/03/20/state_reported_timestamp/

@Clooos
Copy link
Owner

Clooos commented May 12, 2025

Hi! I just found the cause of this! This fix will be part of the next beta 😄

Clooos added a commit that referenced this issue May 14, 2025
- [x] v3.0.0-beta.5/6 fails to render dashboard on some devices #1461 #1462 #1476
- [x] Light slider with hold to slide (default new behavior) are now limited to min 1%, to turn it off, just tap on the card. You can change that in the editor, or in YAML with `allow_light_slider_to_0: true`. #1295
- [x] Bubble backdrop color no longer works as expected #1294
- [x] Relative time formatting inconsistent with Home Assistant #1228
- [x] [3.0.0-beta.6] Slider doesnt work as expected, when entity step size is not 1 #1478
- [x] Slider does not update for brightness if adjusted outside of the card after being adjusted in the card #1367
- [x] Inconsistent and / or wrong color when using sub buttons on a slider #1448
- [x] All buttons are now hidden when a card’s entity is unavailable (like in a media player or cover card) #1453
@Clooos
Copy link
Owner

Clooos commented May 14, 2025

The new beta is here! 😄

https://github.com/Clooos/Bubble-Card/releases/tag/v3.0.0-beta.7

@AlexDaniel
Copy link
Contributor

@Clooos out of curiosity, what was the fix?

@Clooos
Copy link
Owner

Clooos commented May 14, 2025

I removed some parts of the code that was used for preventing the slider to move after an update, but I'm planning to rework this a little bit.

@Clooos Clooos closed this as completed May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Bug-Fix 🥳
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants