Skip to content

Commit

Permalink
Merge pull request #268 from jasonacox/v1.10.1
Browse files Browse the repository at this point in the history
Remove bulb attribute conditional block #265 - Stage for v1.10.1
  • Loading branch information
jasonacox authored Jan 29, 2023
2 parents 6f82afe + ebe8be6 commit a95f8a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
6 changes: 6 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# RELEASE NOTES

## v1.10.1 - Bug Fix for BulbDevice and Zigbee Devices

* PyPI 1.10.1
* Fix _process_message() missing parameters discovered via issue https://github.com/jasonacox/tinytuya/issues/266 by @jasonacox in https://github.com/jasonacox/tinytuya/pull/267
* Removed bulb attribute conditional blocking in BulbDevice set_colour(), set_hsv() and set_colourtemp() as some devices do not correctly report capabilities. Conditional provides debug warning message instead by @jasonacox in https://github.com/jasonacox/tinytuya/issues/265

## v1.10.0 - Tuya Protocol v3.5 Device Support / Scanner Rewrite

* PyPI 1.10.0
Expand Down
26 changes: 11 additions & 15 deletions tinytuya/BulbDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@ def set_colour(self, r, g, b, nowait=False):
nowait(bool): True to send without waiting for response.
"""
if not self.has_colour:
return error_json(
ERR_FUNCTION, "set_colour: Device does not support color."
)
log.debug("set_colour: Device does not appear to support color.")
# return error_json(ERR_FUNCTION, "set_colour: Device does not support color.")
if not 0 <= r <= 255:
return error_json(
ERR_RANGE,
Expand Down Expand Up @@ -354,22 +353,21 @@ def set_hsv(self, h, s, v, nowait=False):
nowait(bool): True to send without waiting for response.
"""
if not self.has_colour:
return error_json(
ERR_FUNCTION, "set_colour: Device does not support color."
)
log.debug("set_hsv: Device does not appear to support color.")
# return error_json(ERR_FUNCTION, "set_hsv: Device does not support color.")
if not 0 <= h <= 1.0:
return error_json(
ERR_RANGE, "set_colour: The value for Hue needs to be between 0 and 1."
ERR_RANGE, "set_hsv: The value for Hue needs to be between 0 and 1."
)
if not 0 <= s <= 1.0:
return error_json(
ERR_RANGE,
"set_colour: The value for Saturation needs to be between 0 and 1.",
"set_hsv: The value for Saturation needs to be between 0 and 1.",
)
if not 0 <= v <= 1.0:
return error_json(
ERR_RANGE,
"set_colour: The value for Value needs to be between 0 and 1.",
"set_hsv: The value for Value needs to be between 0 and 1.",
)

(r, g, b) = colorsys.hsv_to_rgb(h, s, v)
Expand Down Expand Up @@ -521,9 +519,8 @@ def set_brightness(self, brightness, nowait=False):
if state["mode"] == "white":
# for white mode use DPS for brightness
if not self.has_brightness:
return error_json(
ERR_FUNCTION, "set_colour: Device does not support brightness."
)
log.debug("set_brightness: Device does not appear to support brightness.")
# return error_json(ERR_FUNCTION, "set_brightness: Device does not support brightness.")
payload = self.generate_payload(
CONTROL, {self.DPS_INDEX_BRIGHTNESS[self.bulb_type]: brightness}
)
Expand Down Expand Up @@ -572,9 +569,8 @@ def set_colourtemp(self, colourtemp, nowait=False):
nowait(bool): True to send without waiting for response.
"""
if not self.has_colourtemp:
return error_json(
ERR_FUNCTION, "set_colourtemp: Device does not support colortemp."
)
log.debug("set_colourtemp: Device does not appear to support colortemp.")
# return error_json(ERR_FUNCTION, "set_colourtemp: Device does not support colortemp.")
if self.bulb_type == "A" and not 0 <= colourtemp <= 255:
return error_json(
ERR_RANGE,
Expand Down
2 changes: 1 addition & 1 deletion tinytuya/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
# Colorama terminal color capability for all platforms
init()

version_tuple = (1, 10, 0)
version_tuple = (1, 10, 1)
version = __version__ = "%d.%d.%d" % version_tuple
__author__ = "jasonacox"

Expand Down

0 comments on commit a95f8a9

Please sign in to comment.