Skip to content

Commit

Permalink
changed acceptable_values for bulb temp to range(1800, 6500 + 1) just…
Browse files Browse the repository at this point in the history
… for mesh bulbs, fixed typo in variable name in error raised for out of bounds temperature assignment
  • Loading branch information
JohnMTorgerson committed May 16, 2021
1 parent 286fbaf commit 58fe859
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wyze_sdk/api/devices/bulbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ def set_color_temp(self, *, device_mac: str, device_model: str, color_temp: int,
:raises WyzeRequestError: if the new color temperature is not valid
"""
prop_def = BulbProps.color_temp()
prop_def.validate(color_temp)

if device_model in DeviceModels.MESH_BULB:
prop_def = BulbProps.color_temp_mesh()
prop_def.validate(color_temp)

return super()._api_client().run_action_list(
actions={
"key": "set_mesh_property",
Expand All @@ -157,6 +158,10 @@ def set_color_temp(self, *, device_mac: str, device_model: str, color_temp: int,
"provider_key": device_model,
}
)

prop_def = BulbProps.color_temp()
prop_def.validate(color_temp)

return super()._api_client().set_device_property(
mac=device_mac, model=device_model, pid=prop_def.pid, value=color_temp)

Expand Down
4 changes: 4 additions & 0 deletions wyze_sdk/models/devices/bulbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def brightness(cls) -> PropDef:

@classmethod
def color_temp(cls) -> PropDef:
return PropDef("P1502", int, acceptable_values=range(2700, 6500 + 1))

@classmethod
def color_temp_mesh(cls) -> PropDef:
return PropDef("P1502", int, acceptable_values=range(1800, 6500 + 1))

@classmethod
Expand Down

0 comments on commit 58fe859

Please sign in to comment.