0x5e / homebridge-tuya-platform

Make homebridge-tuya-platform great again.
MIT License
218 stars 67 forks source link

Add support in device override to convert hex color to hsv #407

Open vsternbach opened 10 months ago

vsternbach commented 10 months ago

Device Infomation JSON File

No response

Detail Informations

I am trying to setup TV Ambilight and managed to remap power and brightness using device override, but don't understand if it's possible to remap RGB_value (hex color code) to colour_data (that is hsv json) using device override config. As far as I understand it's not a simple conversion and involves several lines of code to do that, I thought that maybe it's possible to expose some helper methods for color conversions and use it in the config for transformation, cause according to this example:

"schema": [{
      "code": "switch_led",
     "onSet": "(value === device.status.find(status => status.code === 'switch_led').value) ? undefined : value"
 }]

and as far as I understand your code you're just running this code using eval. What do you think?

Btw, really nice code, very well written ;)