custom-cards / slider-button-card

A button card with integrated slider
MIT License
105 stars 16 forks source link

fan slider issues with gradient and non-gradient #36

Open ktownsend-personal opened 1 year ago

ktownsend-personal commented 1 year ago

I noticed my fan entity is not defaulting to gradient like it does for other entity types. That is an inconsistent look, so I set it to use gradient. Unfortunately in this mode the slider is broken and toggles the fan off no matter where I try to click to drag the slider. I haven't looked at the code, but my first thought is maybe the logic path is different when there are discrete positions for the slider (off/low/medium/high) and something is broken in that path.

I also noticed that the default slider for my fan, although it works as expected for controlling the speed, hides the spinning fan icon when it is at the highest speed. At each speed position the fan icon color changes closer to the slider color.

rohankapoorcom commented 10 months ago

Can you share some details about the attributes of your fan when it's running? You can get there from Home Assistant --> Developer Tools --> States and then searching for the fan entity in the Filter entities box.

Here are two examples of my fans which are working as expected:

This one is a 3 speed fan (33, 67, 100%) image image

This one is a single speed fan (bathroom fan) image image

My guess is that your fan isn't setting the percentage attribute the same way mine is so different attributes may need to be checked.

ktownsend-personal commented 10 months ago

Just got back from a trip and did some more troubleshooting. I confirmed the following:

I wouldn't have thought to try having both background and direction properties defined, since I assumed direction was an override for the default behavior, but apparently it breaks without it. I only tried it because I spotted your "minimum config" example in your README.md, and I don't know if that existed when I originally had the trouble.

If it's possible, it would be handy to have some kind of default direction when not specified so that it still functions. It would also be nice to have the opacity work appropriately when slider property is not defined for a fan. For example, it works as expected for light entity type when slider property isn't defined.