diff --git a/custom_components/hubitat/light.py b/custom_components/hubitat/light.py index 0866196..c9ea236 100644 --- a/custom_components/hubitat/light.py +++ b/custom_components/hubitat/light.py @@ -1,5 +1,6 @@ """Support for Hubitat lights.""" +import json from logging import getLogger import re from typing import Any, Dict, List, Optional, Union @@ -13,9 +14,7 @@ CMD_ON, CMD_SET_COLOR, CMD_SET_COLOR_TEMP, - CMD_SET_HUE, CMD_SET_LEVEL, - CMD_SET_SAT, Device, ) @@ -117,9 +116,14 @@ async def async_turn_on(self, **kwargs: Any) -> None: await self.send_command(CMD_SET_LEVEL, props["level"], props["time"]) del props["time"] elif "hue" in props: - await self.send_command( - CMD_SET_COLOR, props["hue"], props["sat"], props["level"] + arg = json.dumps( + { + "hue": props["hue"], + "saturation": props["sat"], + "level": props["level"], + } ) + await self.send_command(CMD_SET_COLOR, arg) del props["hue"] del props["sat"] else: @@ -130,8 +134,8 @@ async def async_turn_on(self, **kwargs: Any) -> None: await self.send_command(CMD_ON) if "hue" in props: - await self.send_command(CMD_SET_HUE, props["hue"]) - await self.send_command(CMD_SET_SAT, props["sat"]) + arg = json.dumps({"hue": props["hue"], "saturation": props["sat"]}) + await self.send_command(CMD_SET_COLOR, arg) del props["hue"] del props["sat"]