Bubble-Card
Bubble-Card copied to clipboard
Slider does not update for brightness if adjusted outside of the card after being adjusted in the card
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:
- Create a
buttonslidercard attached to a light - Adjust the brightness via the card
- Adjust the brightness outside of the card
- 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
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! 🍻
Hi and thank again for the feedback! I will check that!
@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: https://github.com/Clooos/Bubble-Card/pull/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.
@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:
- Create a
buttonslidercard attached to a light
type: custom:bubble-card
card_type: button
modules:
- default
button_type: slider
entity: light.living_room
- Adjust the light's brightness via the card
- Adjust the brightness not via the card
- Observe how the the card's visuals for the brightness did not update.
Ahhhh, you're right! Sorry for not getting it right away. I was able to reproduce it, will take a look later.
OK, the fix for lights is right here: https://github.com/Clooos/Bubble-Card/pull/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.
@AlexDaniel Funnily enough, I am the one who added last_updated support in https://github.com/Clooos/Bubble-Card/pull/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.
@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?
@AlexDaniel last_updated updates on attribute changes but last_changed does not.
{{ states['light.living_room'].state }}
{{ states['light.living_room'].attributes.brightness }}
{{ states['light.living_room'].last_changed }}
{{ states['light.living_room'].last_updated }}
@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/
Hi! I just found the cause of this! This fix will be part of the next beta 😄
The new beta is here! 😄
https://github.com/Clooos/Bubble-Card/releases/tag/v3.0.0-beta.7
@Clooos out of curiosity, what was the fix?
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.