Add support of RGB lights (#120)
* Make set_dps available. * Adding RGB support, brightness fix, color_temp range. * Update README for light options * Formatting * Formatting * Need to force to white to ensure color picker is updated. * Detect color mode RGB/HSV based on color length. * Extract rgb encoded color check in method. * Make check method private. * Fix exception when color is not available (maybe when powered off) * Reformat.
This commit is contained in:
@@ -182,6 +182,18 @@ class TuyaDevice(pytuya.TuyaListener):
|
||||
"Not connected to device %s", self._config_entry[CONF_FRIENDLY_NAME]
|
||||
)
|
||||
|
||||
async def set_dps(self, states):
|
||||
"""Change value of a DPs of the Tuya device."""
|
||||
if self._interface is not None:
|
||||
try:
|
||||
await self._interface.set_dps(states)
|
||||
except Exception:
|
||||
_LOGGER.exception("Failed to set DPs %r", states)
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Not connected to device %s", self._config_entry[CONF_FRIENDLY_NAME]
|
||||
)
|
||||
|
||||
@callback
|
||||
def status_updated(self, status):
|
||||
"""Device updated status."""
|
||||
|
Reference in New Issue
Block a user