What kind of color is this? #548
-
My bulb that uses DPS 24 (colour_data_v2) returns a string like this: 00ac03b103ce What on earth is this type of color? To my understanding, the bulbs use HSV. devices.json mapping would give the impression you can simply pass a dict like this: {
"h":80,
"s":80,
"v":80
} But passing an object like that does nothing. Looking to see how to set color using the method |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Check out the SmartBulb example: https://github.com/jasonacox/tinytuya/blob/master/examples/bulb.py and then the source on setting the DPS for hsv: tinytuya/tinytuya/BulbDevice.py Lines 351 to 392 in 11f43cc |
Beta Was this translation helpful? Give feedback.
-
0x00ac = 172 (H, 0-360) Even if you don't instantiate a BulbDevice object you can still use the class functions: import tinytuya
hexvalue = '00ac03b103ce'
print( tinytuya.BulbDevice._hexvalue_to_hsv(hexvalue, bulb='B') )
# (0.4777777777777778, 0.945, 0.974)
print( tinytuya.BulbDevice._hexvalue_to_rgb(hexvalue, bulb='B') )
# (13, 248, 217)
print( tinytuya.BulbDevice._rgb_to_hexvalue(255, 128, 64, bulb='B') )
# 001402ed03e8 @jasonacox What do you think of promoting those 3 functions to officially supported? |
Beta Was this translation helpful? Give feedback.
0x00ac = 172 (H, 0-360)
0x03b1 = 945 = 94.5% (S, 0.0-100.0%)
0x03ce = 974 = 97.4% (V, 0.0-100.0%)
Even if you don't instantiate a BulbDevice object you can still use the class functions:
@jasonacox What do you think of promoting those 3 functions to officially supported?