Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Added @staticmethod decorator to some helping methods
Browse files Browse the repository at this point in the history
To make the tests with python 2.7 pass the static methods in BulbDevice
need to be decorated as staticmethods.
  • Loading branch information
Exilit committed Sep 8, 2018
1 parent 931f305 commit 6859655
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pytuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def __init__(self, dev_id, address, local_key=None):
dev_type = 'device'
super(BulbDevice, self).__init__(dev_id, address, local_key, dev_type)

@staticmethod
def _rgb_to_hexvalue(r, g, b):
"""
Convert an RGB value to the hex representation expected by tuya.
Expand Down Expand Up @@ -390,6 +391,7 @@ def _rgb_to_hexvalue(r, g, b):

return hexvalue

@staticmethod
def _hexvalue_to_rgb(hexvalue):
"""
Converts the hexvalue used by tuya for colour representation into
Expand All @@ -404,6 +406,7 @@ def _hexvalue_to_rgb(hexvalue):

return (r, g, b)

@staticmethod
def _hexvalue_to_hsv(hexvalue):
"""
Converts the hexvalue used by tuya for colour representation into
Expand Down Expand Up @@ -434,6 +437,7 @@ def set_colour(self, r, g, b):
if not 0 <= b <= 255:
raise ValueError("The value for blue needs to be between 0 and 255.")

print(BulbDevice)
hexvalue = BulbDevice._rgb_to_hexvalue(r, g, b)

payload = self.generate_payload(SET, {
Expand Down

0 comments on commit 6859655

Please # to comment.