ljmerza / light-entity-card

Control any light or switch entity
MIT License
233 stars 41 forks source link

YeeLight / Mi BedSideLamp1s issue #57

Open PirvuCatalin opened 3 years ago

PirvuCatalin commented 3 years ago

Hi, When I'm using the sliders to set the brightness to the lowest value I usually go beyond the min value of 1 (sliding over the minimum value with the mouse) and somehow, the lamp is ignoring that settings. After a bit of investigation, I saw that these lamps allow only the value of "3" as the minimum setting, so I added an if else clause in the setBrightness method. Would you mind investigating if you have some free time? This is how the new method looks:

      setBrightness(t, e) {
        const n = parseInt(t.target.value, 0);
        if (!isNaN(n) && !(parseInt(e.attributes.brightness, 0) === n)) {
            if (n < 3) {
                this.callEntityService({ brightness: 3 }, e);
            } else {
                this.callEntityService({ brightness: n }, e);
            }
        }
      }

Something similar is happening with the color temperature, but with slightly bigger values. Will investigate that later.