public void SetLightColor(ScriptNumber lightId, ScriptString value) { Logger.InfoFormat("Setting light #{0} color to '{1}'", lightId, value); var cgPoint = HueColorConverter.XyFromColor(value.ToPrimitiveString().Replace(" ", "")); _lightService.SetLightStateAsync(lightId.ToPrimitiveInt32(), new { on = true, // cannot modify color when light is off xy = new[] { cgPoint.x, cgPoint.y } }); }