Skip to content

Commit

Permalink
Send level when setting light color
Browse files Browse the repository at this point in the history
  • Loading branch information
jason0x43 committed Sep 21, 2022
1 parent 32486fe commit d64f2a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 9 additions & 1 deletion custom_components/hubitat/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,15 @@ async def async_turn_on(self, **kwargs: Any) -> None:
await self.send_command(CMD_ON)

if "hue" in props:
arg = json.dumps({"hue": props["hue"], "saturation": props["sat"]})
data = {
"hue": props["hue"],
"saturation": props["sat"],
}
level = self.get_int_attr(HE_ATTR_LEVEL)
if isinstance(level, int):
data["level"] = level

arg = json.dumps(data)
await self.send_command(CMD_SET_COLOR, arg)
del props["hue"]
del props["sat"]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hubitat/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.8.1",
"version": "0.8.2b1",
"domain": "hubitat",
"name": "Hubitat",
"config_flow": true,
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hubitat"
version = "0.8.1"
version = "0.8.2b1"
description = "A Hubitat integration for Home Assistant"
authors = [
{name = "Jason Cheatham", email = "[email protected]"},
Expand All @@ -15,7 +15,8 @@ homepage = "https://github.com/jason0x43/hacs-hubitat"
[project.optional-dependencies]
[tool.pdm.scripts]
init = {shell = "pdm install && pre-commit install"}
test = {shell = "pyright custom_components/hubitat && pytest tests"}
# test = {shell = "pyright custom_components/hubitat && pytest tests"}
test = {shell = "pytest tests"}

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down

0 comments on commit d64f2a2

Please sign in to comment.