caseyjhol/node-red-contrib-tplink

Problem switching between Temperature and HSB

Closed this issue · 3 comments

There is a problem switching between Temperature mode and HSB mode. For example if you are in HSB (bulb green) you can send {"temperature":6400} and the bulb will go to the correct "temperature", however, if you then send
{"hsb":{"hue":6,"saturation":100,"brightness":50}} the bulb stays in temperature mode and does not change the hue. Perhaps I am missing a step to reset or change the bulb mode? Also Thank you for the work you have done on this project!

----Edit----
I also noticed from the debug that color_temp (temperature) is set at 0 when using HSB if that helps.

After digging around I think the answer is to have the ability to set temperature to 0 which may disable temperature mode and allow HSB to be activated via your node commands! Unfortunately, when trying to set temperature to 0 I get a return that the number is out of range. :-/

I modified kasa.js under the temperature section modified to say
(validateNumber('temperature', input.temperature, 2700, 6500) || input.temperature == 0)

This actually fixes the problem and allows the bulb to change back to HSB mode, there is still a response error that says I am out of range but I think that is just left over. I've never tried to do a Pull request before but I figured you might be able to update quickly now that you know the problem. If I don't hear back from you maybe I'll try to fix the code and branch your project to update but hope this helps! Thanks again!

I've forked the project and fixed the issue. Please review my pull request to add the fix back to the master. Thanks!