python-yeelightbt icon indicating copy to clipboard operation
python-yeelightbt copied to clipboard

Question about light temperature

Open pszafer opened this issue 7 years ago • 3 comments

Hi,

I have Xiaomi Bedside lamp and your library after set colour is always returning "temperature 0". If I set temp by app it returns proper light temp, at least looks like K. Is it some different unit or why is it 0?

pszafer avatar Sep 04 '18 06:09 pszafer

First or second gen lamp? It could be a bug, but IIRC it also reports the kelvin values properly when the lamp itself is in the temperature mode, and otherwise simply 0.

rytilahti avatar Sep 04 '18 13:09 rytilahti

Bluetooth only, so first generation I think. I'm asking because for some reason google_assistant component in HA is trying to get light temperature, and if it is then I've got division by 0 error.

I've changed it to somethink like this for now in _status_cb:

        else:
            if self._dev.temperature > 0:
                self._ct = int(kelvin_to_mired(self._dev.temperature))
            else:
                self._ct = int(kelvin_to_mired(2400))

but for me it somehow no logical that I got temperature 0, it should always return some K temp in any light mode.

pszafer avatar Sep 04 '18 14:09 pszafer

Please feel to submit a PR to change the behavior, if you wish to do so. But returning "some K temp" in any mode would cause inconsistent behavior when changing between modes / depending on what commands are being executed, so I don't think that's the correct approach.

rytilahti avatar Jun 08 '19 07:06 rytilahti