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

100% light #1

Closed Drealine closed 3 years ago

Drealine commented 3 years ago

Hi

I've a problem with the card. When I want to set my brightness light to 100% with the slide, it doesn't work. I can just set the maximum to 99%.

The problem not appear directly in the HA settings.

unknown.png

Thank you very much for your support

Drealine commented 3 years ago

I've solved the issue temporarly. I've set the value to 2.56 to calculate the brightness between 0-100 and 0-255 from HA. I think that is the rounded value in your code that make the issue.

Thank you.

Drealine commented 3 years ago

Ok, see on the code, I can confirm the problem in this line :

this.hass.callService("homeassistant","turn_on",{entity_id:t.entity_id,brightness:2.55*o}),e.value=o}_setWarmth(t,e,i,n){var o=e.value;o>n?o=n:o<i&&(o=i)

To work, I've to set brightness to 2.56.

this.hass.callService("homeassistant","turn_on",{entity_id:t.entity_id,brightness:2.56*o}),e.value=o}_setWarmth(t,e,i,n){var o=e.value;o>n?o=n:o<i&&(o=i)

Other 2.55 are not change in the code. It is only this that make the problem when I tested.

AnthonMS commented 3 years ago

Okay, sounds weird. Because all my lights are correctly being set as 100%.

But thanks for the info. I will fix it as soon as I have time. If nothing breaks by changing it to 2.56, I don't see a problem in making it a permanent fix.

AnthonMS commented 3 years ago

I have made the change permenant and compiled and pushed the code in the latest commits. If it hasn't fixed the issue, let me know.