Skip to content

Commit

Permalink
Merge pull request #26 from JohnMTorgerson/fix-min-temp
Browse files Browse the repository at this point in the history
Fix min temp for mesh bulbs to be 1800
  • Loading branch information
shauntarves authored May 17, 2021
2 parents 8b0eb67 + 58fe859 commit 61a6c6a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 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
2 changes: 1 addition & 1 deletion wyze_sdk/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,4 @@ def validate(self, value: Any):
logging.debug(f"value {value} found in acceptable_values, passing")
return

raise WyzeRequestError(f"{value} must be one of {self.acceptable_values}")
raise WyzeRequestError(f"{value} must be one of {self._acceptable_values}")
4 changes: 4 additions & 0 deletions wyze_sdk/models/devices/bulbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def brightness(cls) -> PropDef:
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
def color(cls) -> PropDef:
return PropDef("P1507", str)
Expand Down

0 comments on commit 61a6c6a

Please sign in to comment.