Remap brightness range from 0-100 to 1-100
farshidtz opened this issue · 1 comments
farshidtz commented
#3 fixed the mapping to that the Matter ranges are mapped to Tapo accepted ranges. One remaining issue is the brightness level which only accepts 1-100 instead of 0-100. Input Matter byte values <=2 will result in errors.
See #3 (comment)
MonicaisHer commented
potential solution:
# hue
if attributeId == 0:
# reset the value to 0 because an empty list is returned
# when the input values for hue is set to 0
if not value:
value = bytes([0])
print("[callback] color hue={}".format(value[0]))
set_hue(math.trunc(value[0] * (359/254)))
# saturation
elif attributeId == 1:
# reset the value to 0 because an empty list is returned
# when the input values for saturation is set to 0
if not value:
value = bytes([0])
print("[callback] color saturation={}".format(value[0]))
set_saturation(math.trunc(value[0] * (100/254)))