AnthonMS / my-cards

Bundle of my custom Lovelace cards for Home Assistant. Includes: my-slider, my-slider-v2, my-button
Other
104 stars 27 forks source link

No step option? #27

Closed Kmanggaard closed 9 months ago

Kmanggaard commented 2 years ago

I really miss it. The "intermediate: true" paired with a "step" value of 5-10 is the closest i've gotten to real-time sliders, which to me is the one big issue with HA. Without "step" there's just too much data transfer.

If you wanted to pursue the holy grail of real-time sliders i'd suggest looking into Deconz. Their sliders are smooth and responsive, but unfortunately it doesn't translate well to HA.

Virkelig godt arbejde! Tak!

AnthonMS commented 2 years ago

All my lights are through DeConz already. What do you mean by suggesting looking at the Deconz sliders? And that they don't translate well into HA?

I am assuming you are talking about the slider-v2, and that it doesn't have intermediate and step keys. It does have both. You are correct by assuming it doesn't if you haven't looked at the documentation. But it will only update the entities value, if you have changed the value on the slider to exceed the step boundary. It just doesn't show the steps like a regular slider where it jumps 5 steps on the slider.

This is actually something I thought most people would find to be a nice feature. But also more because, I haven't worked with math this much in many years, so it has been off by just a smidge many times during development. And just calculating which state to set relative to how far you have pulled the slider, and taking into consideration if it's inverted, flipped, vertical. It has just been a lot of math, lol. So I didn't really feel like calculating if it should actually update the slider progress, ONLY if the value that amounts to the percentage you have pulled, subtracted from the maximum value, will exceed step.

I can easily add this now that I have thought about it and written my notes above here for later.

Selv tak! Sætter pris på det!

Kmanggaard commented 2 years ago

All I meant was that Deconz must be doing something differently / better, since it's so much more responsive.

So the step key works! that's great news. I just assumed it didn't since the slider doesn't show the steps.

Since you're using Deconz, I want to ask if you're using Deconz add-on or ZHA and if you're having issues with sliders being glitchy / jumpy (all sliders, intermediate updates or not) . Don't know how better to explain it.

AnthonMS commented 2 years ago

Yeah, I think they can get their sliders for their own lights to be much more responsive because they can listen for changes very carefully. I just have to wait for lovelace to update the entity before I can update the slider position.

I do have that problem with my Deconz lights, but only my deconz lights. I am assuming it's the way HA and Deconz talks to each other and updates each other on state changes. There might be some overlap or bug where deconz quickly responds back with 1 or 255 brightness for a second or 2 while it is gradually setting the correct brightness.

I do have a bit of WLED in my setup, and they are much more stable when changing the brightness with this slider.

I just want to ask, is this a feature you would like added? Where it shows the steps on the slider. Because then I will just look into it now before some of the bigger stuff. Otherwise I will save it for later and add a config key like 'showSteps' where if it's true, then it will show each step on the slider like a normal html input range.

Kmanggaard commented 2 years ago

The stepped sliders are not important to me at all, as Long as the data stream is being throttled.

Interesting about the WLED’s. That makes me wonder if the Deconz add-on is sending two “on” calls, one for brightness and one for color. I know that is required of some light bulbs.

AnthonMS commented 1 year ago

I have checked up on this and tested more. The stepping logic is very faulty in the V2. I will get this fixed next time I'm looking at the code. Sorry about the inconvenience.

If intermediate is not on. It will set any state to the entity, as long as the step is above the stepping threshold. So if the step on an input_number is 5, the current state is 15, you pull the slider to 22 and let go, then it will set the value to be 22, not 20 or 25 as it obviously should. It will however not set the value to 18, since 18-15=3 and 3 < 5, which was the threshold.

It will get fixed next time I look at the code.

AnthonMS commented 9 months ago

This has been fixed in my-slider-v2

The slider will only update to a value that is divisible by step.