juanboro / cync2mqtt

Bridge Cync bluetooth mesh to mqtt
39 stars 7 forks source link

Color Temperature (Scale/Ratio Mismatch?) #10

Closed zimmra closed 2 years ago

zimmra commented 2 years ago

'Actual' temps are what cync2mqtt reports from lights when changed from Cync app. 'HASS' temps are what HASS tries to push to cync2mqtt

HASS ranges from 153 (coolest/~7000K) to 500 (warmest/~2000K) Actual ranges from 100 (coolest/~7000K) to 1 (warmest/~2000K)

juanboro commented 2 years ago

Yeah - I see in the Telink documentation that the range is 0-100 (percentage). I'll add the scale functions in tomorrow. Thanks for finding the ranges.

zimmra commented 2 years ago

To go from HASS temp to cync2mqtt temp (for setting temp):

((((temperature)-500)/(500-153)*(100-1)-1)*-1)

This converts 153 => 100, and 500 => 1

To go from cync2mqtt temp to HASS temp (for getting temp):

((((temperature)-1)/(1-100)*(153-500)-500)*-1)

This converts 1=>500, and 100=>153

I'll add the scale functions in tomorrow

I'll see if I can figure out where to punch these in in the meantime My attempts pretty fruitless, I look forward to see how you get implemented.

juanboro commented 2 years ago

Fyi - I checked in some updates to set the 2k to 7k (500mired to 142mired) in HA discovery and then scale by that.